<!-- مكتبات jsPDF و html2canvas --> <script src="/p/pdfmake.js"></script> <script src="/p/vfs_fonts.js"></script> <script src="/p/jspdf.umd.min.js"></script> <script src="/p/html2canvas.min.js"></script> <script> $(document).ready(function () { const pageTitle = document.title || 'تقرير'; const table = $('#example1').DataTable({ language: { url: '/p/ar.json' }, dom: 'Bfrtip', columnDefs: [ { targets: '_all', className: 'dt-right' } ], buttons: [ { extend: 'copy', text: 'نسخ', title: pageTitle, exportOptions: { columns: [1, 2, 3, 4, 5] } }, { extend: 'excel', text: 'تصدير Excel', title: pageTitle, exportOptions: { columns: [1, 2, 3, 4, 5] } }, { extend: 'print', text: 'طباعة', title: pageTitle, exportOptions: { columns: [1, 2, 3, 4, 5] } }, { extend: 'pdfHtml5', text: 'تصدير PDF', title: pageTitle, exportOptions: { columns: [1, 2, 3, 4, 5] }, customize: function (doc) { doc.defaultStyle = { alignment: 'right', direction: 'rtl', fontSize: 15 // ✅ تكبير الخط }; doc.styles.tableHeader.alignment = 'center'; // إضافة عنوان الصفحة const cleanTitle = pageTitle.replace(/[\\/:*?"<>|]/g, '').trim(); doc.content.unshift({ text: cleanTitle, style: 'header', alignment: 'center', margin: [0, 0, 0, 10], direction: 'rtl' }); // عكس ترتيب الأعمدة داخل كل صف const table = doc.content.find(item => item.table); if (table) { table.alignment = 'center'; table.table.body = table.table.body.map(row => row.reverse()); } } } ] }); table.buttons().container().appendTo('#example1_wrapper .col-md-6:eq(0)'); }); </script>
It looks like you're new here. If you want to get involved, click one of these buttons!
Replies