@digicole/pdfmake-rtl 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.html ADDED
@@ -0,0 +1,927 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" dir="ltr">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>PDFMake RTL - Multi-Language Table Examples</title>
7
+ <script src="https://unpkg.com/pdfmake@0.2.7/build/pdfmake.min.js"></script>
8
+ <script src="https://unpkg.com/pdfmake@0.2.7/build/vfs_fonts.js"></script>
9
+ <style>
10
+ * {
11
+ margin: 0;
12
+ padding: 0;
13
+ box-sizing: border-box;
14
+ }
15
+
16
+ body {
17
+ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
18
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
19
+ min-height: 100vh;
20
+ padding: 20px;
21
+ }
22
+
23
+ .container {
24
+ max-width: 1200px;
25
+ margin: 0 auto;
26
+ background: white;
27
+ border-radius: 15px;
28
+ box-shadow: 0 20px 40px rgba(0,0,0,0.1);
29
+ overflow: hidden;
30
+ }
31
+
32
+ .header {
33
+ background: linear-gradient(135deg, #3498db, #2c3e50);
34
+ color: white;
35
+ padding: 40px;
36
+ text-align: center;
37
+ }
38
+
39
+ .header h1 {
40
+ font-size: 2.5em;
41
+ margin-bottom: 10px;
42
+ font-weight: 300;
43
+ }
44
+
45
+ .header p {
46
+ font-size: 1.2em;
47
+ opacity: 0.9;
48
+ }
49
+
50
+ .rtl-text {
51
+ direction: rtl;
52
+ text-align: right;
53
+ font-family: 'Arial Unicode MS', 'Tahoma', sans-serif;
54
+ }
55
+
56
+ .content {
57
+ padding: 40px;
58
+ }
59
+
60
+ .section {
61
+ margin-bottom: 40px;
62
+ }
63
+
64
+ .section h2 {
65
+ color: #2c3e50;
66
+ border-bottom: 3px solid #3498db;
67
+ padding-bottom: 10px;
68
+ margin-bottom: 20px;
69
+ font-size: 1.8em;
70
+ }
71
+
72
+ .features {
73
+ display: grid;
74
+ grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
75
+ gap: 20px;
76
+ margin-bottom: 30px;
77
+ }
78
+
79
+ .feature {
80
+ background: #f8f9fa;
81
+ padding: 20px;
82
+ border-radius: 10px;
83
+ border-left: 4px solid #3498db;
84
+ }
85
+
86
+ .feature h3 {
87
+ color: #2c3e50;
88
+ margin-bottom: 10px;
89
+ }
90
+
91
+ .code-block {
92
+ background: #2c3e50;
93
+ color: #ecf0f1;
94
+ padding: 20px;
95
+ border-radius: 10px;
96
+ overflow-x: auto;
97
+ font-family: 'Courier New', monospace;
98
+ margin: 20px 0;
99
+ }
100
+
101
+ .buttons {
102
+ display: flex;
103
+ gap: 15px;
104
+ flex-wrap: wrap;
105
+ justify-content: center;
106
+ margin: 30px 0;
107
+ }
108
+
109
+ .btn {
110
+ background: linear-gradient(135deg, #3498db, #2980b9);
111
+ color: white;
112
+ border: none;
113
+ padding: 15px 30px;
114
+ border-radius: 25px;
115
+ cursor: pointer;
116
+ font-size: 16px;
117
+ font-weight: 500;
118
+ transition: all 0.3s ease;
119
+ box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
120
+ }
121
+
122
+ .btn:hover {
123
+ transform: translateY(-2px);
124
+ box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
125
+ }
126
+
127
+ .btn-success {
128
+ background: linear-gradient(135deg, #27ae60, #219a52);
129
+ box-shadow: 0 4px 15px rgba(39, 174, 96, 0.3);
130
+ }
131
+
132
+ .btn-success:hover {
133
+ box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
134
+ }
135
+
136
+ .btn-warning {
137
+ background: linear-gradient(135deg, #f39c12, #e67e22);
138
+ box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
139
+ }
140
+
141
+ .btn-warning:hover {
142
+ box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
143
+ }
144
+
145
+ .example-preview {
146
+ background: #f8f9fa;
147
+ border: 2px dashed #bdc3c7;
148
+ border-radius: 10px;
149
+ padding: 20px;
150
+ margin: 20px 0;
151
+ text-align: center;
152
+ }
153
+
154
+ .language-samples {
155
+ display: grid;
156
+ grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
157
+ gap: 20px;
158
+ margin: 20px 0;
159
+ }
160
+
161
+ .language-sample {
162
+ background: #ecf0f1;
163
+ padding: 15px;
164
+ border-radius: 10px;
165
+ border-top: 4px solid;
166
+ }
167
+
168
+ .arabic { border-top-color: #e74c3c; }
169
+ .persian { border-top-color: #9b59b6; }
170
+ .urdu { border-top-color: #f39c12; }
171
+ .english { border-top-color: #3498db; }
172
+
173
+ .footer {
174
+ background: #34495e;
175
+ color: white;
176
+ padding: 30px;
177
+ text-align: center;
178
+ }
179
+
180
+ .status {
181
+ background: #dff0d8;
182
+ border: 1px solid #d6e9c6;
183
+ color: #3c763d;
184
+ padding: 15px;
185
+ border-radius: 5px;
186
+ margin: 20px 0;
187
+ display: none;
188
+ }
189
+
190
+ @media (max-width: 768px) {
191
+ .buttons {
192
+ flex-direction: column;
193
+ align-items: center;
194
+ }
195
+
196
+ .btn {
197
+ width: 100%;
198
+ max-width: 300px;
199
+ }
200
+ }
201
+ </style>
202
+ </head>
203
+ <body>
204
+ <div class="container">
205
+ <div class="header">
206
+ <h1>PDFMake RTL</h1>
207
+ <p>Multi-Language Table Generator with Automatic RTL Support</p>
208
+ <div class="rtl-text" style="margin-top: 15px; font-size: 1.1em;">
209
+ <div>العربية - فارسی - اردو - English</div>
210
+ </div>
211
+ </div>
212
+
213
+ <div class="content">
214
+ <div class="section">
215
+ <h2>🚀 Key Features</h2>
216
+ <div class="features">
217
+ <div class="feature arabic">
218
+ <h3>Arabic Support - الدعم العربي</h3>
219
+ <p>Automatic right-to-left text alignment and column reversal for Arabic content.</p>
220
+ <div class="rtl-text">يدعم التحكم الآلي في اتجاه النص والجداول</div>
221
+ </div>
222
+ <div class="feature persian">
223
+ <h3>Persian Support - پشتیبانی فارسی</h3>
224
+ <p>Full Persian/Farsi script support with proper text shaping.</p>
225
+ <div class="rtl-text">پشتیبانی کامل از متن فارسی با شکل‌دهی مناسب</div>
226
+ </div>
227
+ <div class="feature urdu">
228
+ <h3>Urdu Support - اردو سپورٹ</h3>
229
+ <p>Complete Urdu language support with Unicode compliance.</p>
230
+ <div class="rtl-text">مکمل اردو زبان کی سپورٹ یونیکوڈ کے ساتھ</div>
231
+ </div>
232
+ <div class="feature english">
233
+ <h3>Mixed Content</h3>
234
+ <p>Seamlessly mix English with RTL languages in the same document.</p>
235
+ <div class="rtl-text">مزج محتوى إنجليزي مع النصوص العربية</div>
236
+ </div>
237
+ </div>
238
+ </div>
239
+
240
+ <div class="section">
241
+ <h2>📋 How to Use Tables</h2>
242
+ <p>Creating multi-language tables is simple with PDFMake RTL. The library automatically detects the text direction and applies appropriate formatting:</p>
243
+
244
+ <div class="code-block">
245
+ const tableDoc = {
246
+ content: [
247
+ {
248
+ table: {
249
+ widths: ['*', '*', '*', '*'],
250
+ headerRows: 1,
251
+ body: [
252
+ // Headers in multiple languages
253
+ ['Name الاسم', 'Position المنصب', 'Department القسم', 'Salary الراتب'],
254
+
255
+ // Mixed language data
256
+ ['Ahmed أحمد', 'Developer مطور', 'IT تقنية المعلومات', '$5000'],
257
+ ['فاطمه Fatima', 'مدیر Manager', 'HR منابع انسانی', '$7000'],
258
+ ['حسن Hassan', 'Analyst محلل', 'Finance مالية', '$6000']
259
+ ]
260
+ }
261
+ }
262
+ ]
263
+ };
264
+ </div>
265
+ </div>
266
+
267
+ <div class="section">
268
+ <h2>🌍 Language Examples</h2>
269
+ <div class="language-samples">
270
+ <div class="language-sample arabic">
271
+ <h4>Arabic Sample - نموذج عربي</h4>
272
+ <div class="rtl-text">
273
+ <strong>اسم الشركة:</strong> شركة التقنية المتقدمة<br>
274
+ <strong>العنوان:</strong> الرياض، المملكة العربية السعودية<br>
275
+ <strong>الهاتف:</strong> +966-11-1234567
276
+ </div>
277
+ </div>
278
+ <div class="language-sample persian">
279
+ <h4>Persian Sample - نمونه فارسی</h4>
280
+ <div class="rtl-text">
281
+ <strong>نام شرکت:</strong> شرکت فناوری پیشرفته<br>
282
+ <strong>آدرس:</strong> تهران، جمهوری اسلامی ایران<br>
283
+ <strong>تلفن:</strong> +98-21-1234567
284
+ </div>
285
+ </div>
286
+ <div class="language-sample urdu">
287
+ <h4>Urdu Sample - اردو نمونہ</h4>
288
+ <div class="rtl-text">
289
+ <strong>کمپنی کا نام:</strong> ایڈوانسڈ ٹیکنالوجی کمپنی<br>
290
+ <strong>پتہ:</strong> کراچی، پاکستان<br>
291
+ <strong>فون:</strong> +92-21-1234567
292
+ </div>
293
+ </div>
294
+ <div class="language-sample english">
295
+ <h4>English Sample</h4>
296
+ <div>
297
+ <strong>Company Name:</strong> Advanced Technology Corp<br>
298
+ <strong>Address:</strong> New York, United States<br>
299
+ <strong>Phone:</strong> +1-212-1234567
300
+ </div>
301
+ </div>
302
+ </div>
303
+ </div>
304
+
305
+ <div class="section">
306
+ <h2>📄 Live Examples</h2>
307
+ <p>Try these examples to see PDFMake RTL in action:</p>
308
+
309
+ <div class="buttons">
310
+ <button class="btn" onclick="generateSimpleTable()">
311
+ 📊 Simple Mixed Table
312
+ </button>
313
+ <button class="btn btn-success" onclick="generateCompanyReport()">
314
+ 🏢 Company Report
315
+ </button>
316
+ <button class="btn btn-warning" onclick="generateInvoice()">
317
+ 🧾 Multilingual Invoice
318
+ </button>
319
+ <button class="btn" onclick="generateEmployeeList()">
320
+ 👥 Employee Directory
321
+ </button>
322
+ </div>
323
+
324
+ <div class="example-preview">
325
+ <p><strong>📋 Preview:</strong> Click any button above to generate and download a PDF with multi-language tables!</p>
326
+ <div class="rtl-text" style="margin-top: 10px;">
327
+ انقر على أي زر أعلاه لإنشاء وتحميل ملف PDF بجداول متعددة اللغات!
328
+ </div>
329
+ </div>
330
+
331
+ <div class="status" id="status"></div>
332
+ </div>
333
+
334
+ <div class="section">
335
+ <h2>💡 Advanced Features</h2>
336
+ <div class="code-block">
337
+ // Advanced table with styling and long text
338
+ const advancedDoc = {
339
+ content: [
340
+ {
341
+ table: {
342
+ widths: ['20%', '30%', '25%', '25%'],
343
+ headerRows: 2,
344
+ body: [
345
+ // Main header
346
+ [
347
+ {text: 'Employee Info\nمعلومات الموظف\nاطلاعات کارمند\nملازم کی معلومات',
348
+ style: 'tableHeader', colSpan: 2},
349
+ {},
350
+ {text: 'Performance\nالأداء\nعملکرد\nکارکردگی',
351
+ style: 'tableHeader', colSpan: 2},
352
+ {}
353
+ ],
354
+ // Sub headers
355
+ ['Name\nالاسم\nنام\nنام', 'Department\nالقسم\nبخش\nشعبہ', 'Rating\nالتقييم\nرتبه\nریٹنگ', 'Notes\nملاحظات\nیادداشت\nنوٹس'],
356
+
357
+ // Data rows with mixed content
358
+ ['أحمد محمد\nAhmed Mohammad', 'تطوير البرمجيات\nSoftware Development\nتوسعه نرم افزار\nسافٹ ویئر ڈیولپمنٹ', 'ممتاز\nExcellent\nعالی\nبہترین', 'موظف متميز يستحق الترقية\nOutstanding employee deserving promotion\nکارمند ممتاز شایسته ارتقاء\nنمایاں ملازم جو ترقی کا حقدار ہے']
359
+ ]
360
+ },
361
+ layout: {
362
+ hLineWidth: function (i, node) {
363
+ return (i === 0 || i === node.table.body.length) ? 2 : 1;
364
+ },
365
+ vLineWidth: function (i, node) {
366
+ return (i === 0 || i === node.table.widths.length) ? 2 : 1;
367
+ },
368
+ hLineColor: function (i, node) {
369
+ return (i === 0 || i === node.table.body.length) ? '#2c3e50' : '#bdc3c7';
370
+ },
371
+ vLineColor: function (i, node) {
372
+ return (i === 0 || i === node.table.widths.length) ? '#2c3e50' : '#bdc3c7';
373
+ }
374
+ }
375
+ }
376
+ ],
377
+ styles: {
378
+ tableHeader: {
379
+ bold: true,
380
+ fontSize: 11,
381
+ color: 'white',
382
+ fillColor: '#3498db',
383
+ alignment: 'center'
384
+ }
385
+ }
386
+ };
387
+ </div>
388
+ </div>
389
+ </div>
390
+
391
+ <div class="footer">
392
+ <p>&copy; 2025 PDFMake RTL - Enhanced Multi-Language PDF Generation</p>
393
+ <div class="rtl-text" style="margin-top: 10px;">
394
+ © ٢٠٢٥ PDFMake RTL - توليد ملفات PDF متعددة اللغات محسّنة
395
+ </div>
396
+ </div>
397
+ </div>
398
+
399
+ <script>
400
+ // RTL character detection for client-side
401
+ function isRTLChar(char) {
402
+ const code = char.charCodeAt(0);
403
+ return (code >= 0x0600 && code <= 0x06FF) || // Arabic
404
+ (code >= 0x06A9 && code <= 0x06AF) || // Persian
405
+ (code >= 0x06C0 && code <= 0x06C3) || // Persian Extended
406
+ (code >= 0x0679 && code <= 0x0679) || // Urdu Tteh
407
+ (code >= 0x067E && code <= 0x067E) || // Urdu Peh
408
+ (code >= 0x0686 && code <= 0x0686) || // Urdu Tcheh
409
+ (code >= 0x0750 && code <= 0x077F) || // Arabic Supplement
410
+ (code >= 0xFE70 && code <= 0xFEFF); // Arabic Presentation Forms
411
+ }
412
+
413
+ function showStatus(message, type = 'success') {
414
+ const status = document.getElementById('status');
415
+ status.textContent = message;
416
+ status.style.display = 'block';
417
+ status.className = `status ${type}`;
418
+
419
+ setTimeout(() => {
420
+ status.style.display = 'none';
421
+ }, 3000);
422
+ }
423
+
424
+ // Simple mixed language table
425
+ function generateSimpleTable() {
426
+ const docDefinition = {
427
+ content: [
428
+ { text: 'Multi-Language Table Example - مثال جدول متعدد اللغات - نمونه جدول چند زبانه - کثیر لسانی ٹیبل کی مثال',
429
+ style: 'title' },
430
+
431
+ {
432
+ table: {
433
+ widths: ['*', '*', '*', '*'],
434
+ headerRows: 1,
435
+ body: [
436
+ ['Name\nالاسم\nنام\nنام', 'Position\nالمنصب\nسمت\nعہدہ', 'Department\nالقسم\nبخش\nشعبہ', 'Email\nالبريد\nایمیل\nای میل'],
437
+ ['Ahmed Ali\nأحمد علي', 'Manager\nمدير\nمدیر\nمینیجر', 'IT\nتقنية المعلومات\nفناوری اطلاعات\nآئی ٹی', 'ahmed@company.com'],
438
+ ['فاطمة محمد\nFatima Mohammad', 'مطورة\nDeveloper\nتوسعه دهنده\nڈیولپر', 'Software\nبرمجيات\nنرم افزار\nسافٹ ویئر', 'fatima@company.com'],
439
+ ['Hassan Khan\nحسن خان', 'Analyst\nمحلل\nتحلیلگر\nتجزیہ کار', 'Finance\nمالية\nمالی\nمالیات', 'hassan@company.com'],
440
+ ['مریم احمدی\nMaryam Ahmadi', 'مصممة\nDesigner\nطراح\nڈیزائنر', 'Creative\nإبداعي\nخلاق\nتخلیقی', 'maryam@company.com']
441
+ ]
442
+ },
443
+ layout: {
444
+ hLineWidth: function (i, node) {
445
+ return (i === 0 || i === node.table.body.length) ? 2 : 1;
446
+ },
447
+ vLineWidth: function (i, node) {
448
+ return (i === 0 || i === node.table.widths.length) ? 2 : 1;
449
+ },
450
+ hLineColor: function (i, node) {
451
+ return (i === 0 || i === node.table.body.length) ? '#2c3e50' : '#bdc3c7';
452
+ },
453
+ vLineColor: function (i, node) {
454
+ return (i === 0 || i === node.table.widths.length) ? '#2c3e50' : '#bdc3c7';
455
+ }
456
+ }
457
+ }
458
+ ],
459
+ styles: {
460
+ title: {
461
+ fontSize: 18,
462
+ bold: true,
463
+ margin: [0, 0, 0, 20],
464
+ alignment: 'center'
465
+ }
466
+ },
467
+ defaultStyle: {
468
+ fontSize: 10,
469
+ lineHeight: 1.3
470
+ }
471
+ };
472
+
473
+ pdfMake.createPdf(docDefinition).download('simple-multilingual-table.pdf');
474
+ showStatus('✅ Simple table PDF generated successfully!');
475
+ }
476
+
477
+ // Company report with detailed information
478
+ function generateCompanyReport() {
479
+ const docDefinition = {
480
+ content: [
481
+ { text: 'Company Annual Report - التقرير السنوي للشركة - گزارش سالانه شرکت - کمپنی کی سالانہ رپورٹ',
482
+ style: 'mainTitle' },
483
+
484
+ { text: 'Department Performance Summary', style: 'sectionHeader', margin: [0, 20, 0, 10] },
485
+
486
+ {
487
+ table: {
488
+ widths: ['25%', '20%', '25%', '30%'],
489
+ headerRows: 1,
490
+ body: [
491
+ [
492
+ { text: 'Department\nالقسم\nبخش\nشعبہ', style: 'tableHeader' },
493
+ { text: 'Staff\nالموظفون\nپرسنل\nعملہ', style: 'tableHeader' },
494
+ { text: 'Budget (USD)\nالميزانية\nبودجه\nبجٹ', style: 'tableHeader' },
495
+ { text: 'Performance\nالأداء\nعملکرد\nکارکردگی', style: 'tableHeader' }
496
+ ],
497
+ [
498
+ 'Information Technology\nتقنية المعلومات\nفناوری اطلاعات\nانفارمیشن ٹیکنالوجی',
499
+ '25 موظف\n25 Staff\n۲۵ نفر\n۲۵ ملازم',
500
+ '$2,500,000\nدولار أمريكي\nدلار آمریکا\nامریکی ڈالر',
501
+ 'Excellent ممتاز\nExcellent عالی\nExcellent بہترین'
502
+ ],
503
+ [
504
+ 'Human Resources\nالموارد البشرية\nمنابع انسانی\nانسانی وسائل',
505
+ '15 موظف\n15 Staff\n۱۵ نفر\n۱۵ ملازم',
506
+ '$800,000\nدولار أمريكي\nدلار آمریکا\nامریکی ڈالر',
507
+ 'Good جيد\nGood خوب\nGood اچھا'
508
+ ],
509
+ [
510
+ 'Finance & Accounting\nالمالية والمحاسبة\nمالی و حسابداری\nمالیات اور اکاؤنٹنگ',
511
+ '20 موظف\n20 Staff\n۲۰ نفر\n۲۰ ملازم',
512
+ '$1,200,000\nدولار أمريكي\nدلار آمریکا\nامریکی ڈالر',
513
+ 'Excellent ممتاز\nExcellent عالی\nExcellent بہترین'
514
+ ],
515
+ [
516
+ 'Marketing & Sales\nالتسويق والمبيعات\nبازاریابی و فروش\nمارکیٹنگ اور سیلز',
517
+ '30 موظف\n30 Staff\n۳۰ نفر\n۳۰ ملازم',
518
+ '$1,800,000\nدولار أمريكي\nدلار آمریکا\nامریکی ڈالر',
519
+ 'Very Good جيد جداً\nVery Good خیلی خوب\nVery Good بہت اچھا'
520
+ ]
521
+ ]
522
+ },
523
+ layout: {
524
+ hLineWidth: function (i, node) {
525
+ return (i === 0 || i === node.table.body.length) ? 2 : 1;
526
+ },
527
+ vLineWidth: function (i, node) {
528
+ return (i === 0 || i === node.table.widths.length) ? 2 : 1;
529
+ },
530
+ hLineColor: function (i, node) {
531
+ return (i === 0 || i === node.table.body.length) ? '#34495e' : '#95a5a6';
532
+ },
533
+ vLineColor: function (i, node) {
534
+ return (i === 0 || i === node.table.widths.length) ? '#34495e' : '#95a5a6';
535
+ }
536
+ }
537
+ },
538
+
539
+ { text: 'Key Achievements - الإنجازات الرئيسية - دستاوردهای کلیدی - اہم کامیابیاں',
540
+ style: 'sectionHeader', margin: [0, 30, 0, 10] },
541
+
542
+ {
543
+ ul: [
544
+ 'Revenue increased by 25% - زيادة الإيرادات بنسبة ٢٥٪ - افزایش درآمد ۲۵٪ - آمدنی میں ۲۵٪ اضافہ',
545
+ 'Customer satisfaction reached 98% - رضا العملاء وصل إلى ٩٨٪ - رضایت مشتری به ۹۸٪ رسید - کسٹمر کی اطمینان ۹۸٪ تک پہنچی',
546
+ 'New product launch successful - إطلاق منتج جديد بنجاح - راه‌اندازی موفق محصول جدید - نئی پروڈکٹ کا کامیاب آغاز',
547
+ 'International expansion to 5 countries - التوسع الدولي إلى ٥ دول - گسترش بین‌المللی به ۵ کشور - ۵ ممالک میں بین الاقوامی توسیع'
548
+ ]
549
+ }
550
+ ],
551
+ styles: {
552
+ mainTitle: {
553
+ fontSize: 20,
554
+ bold: true,
555
+ margin: [0, 0, 0, 30],
556
+ alignment: 'center',
557
+ color: '#2c3e50'
558
+ },
559
+ sectionHeader: {
560
+ fontSize: 14,
561
+ bold: true,
562
+ color: '#34495e'
563
+ },
564
+ tableHeader: {
565
+ bold: true,
566
+ fontSize: 11,
567
+ color: 'white',
568
+ fillColor: '#3498db',
569
+ alignment: 'center'
570
+ }
571
+ },
572
+ defaultStyle: {
573
+ fontSize: 9,
574
+ lineHeight: 1.4
575
+ }
576
+ };
577
+
578
+ pdfMake.createPdf(docDefinition).download('company-report-multilingual.pdf');
579
+ showStatus('🏢 Company report PDF generated successfully!');
580
+ }
581
+
582
+ // Multilingual invoice
583
+ function generateInvoice() {
584
+ const docDefinition = {
585
+ content: [
586
+ {
587
+ columns: [
588
+ {
589
+ width: '*',
590
+ text: [
591
+ { text: 'INVOICE\n', style: 'invoiceTitle' },
592
+ { text: 'فاتورة\n', style: 'invoiceTitle' },
593
+ { text: 'صورتحساب\n', style: 'invoiceTitle' },
594
+ { text: 'انوائس', style: 'invoiceTitle' }
595
+ ]
596
+ },
597
+ {
598
+ width: '*',
599
+ text: [
600
+ 'Invoice #: INV-2025-001\n',
601
+ 'رقم الفاتورة: INV-2025-001\n',
602
+ 'شماره صورتحساب: INV-2025-001\n',
603
+ 'انوائس نمبر: INV-2025-001\n\n',
604
+ 'Date: January 5, 2025\n',
605
+ 'التاريخ: ٥ يناير ٢٠٢٥\n',
606
+ 'تاریخ: ۵ ژانویه ۲۰۲۵\n',
607
+ 'تاریخ: ۵ جنوری ۲۰۲۵'
608
+ ],
609
+ alignment: 'right'
610
+ }
611
+ ]
612
+ },
613
+
614
+ { text: '', margin: [0, 20] },
615
+
616
+ {
617
+ columns: [
618
+ {
619
+ width: '50%',
620
+ text: [
621
+ { text: 'Bill To:\n', style: 'sectionHeader' },
622
+ { text: 'إرسال الفاتورة إلى:\n', style: 'sectionHeader' },
623
+ { text: 'صورتحساب برای:\n', style: 'sectionHeader' },
624
+ { text: 'بل بھیجیں:\n\n', style: 'sectionHeader' },
625
+
626
+ 'ABC Corporation\nشركة ABC\nشرکت ABC\nABC کارپوریشن\n\n',
627
+ '123 Business Street\nشارع الأعمال ١٢٣\nخیابان تجاری ۱۲۳\n۱۲۳ بزنس سٹریٹ\n\n',
628
+ 'New York, NY 10001\nنيويورك، نيويورك ١٠٠٠١\nنیویورک، نیویورک ۱۰۰۰۱\nنیو یارک، NY 10001'
629
+ ]
630
+ },
631
+ {
632
+ width: '50%',
633
+ text: [
634
+ { text: 'From:\n', style: 'sectionHeader' },
635
+ { text: 'من:\n', style: 'sectionHeader' },
636
+ { text: 'از:\n', style: 'sectionHeader' },
637
+ { text: 'سے:\n\n', style: 'sectionHeader' },
638
+
639
+ 'Tech Solutions Ltd\nشركة الحلول التقنية المحدودة\nشرکت راه‌حل‌های فنی\nٹیک سلوشنز لمیٹڈ\n\n',
640
+ '456 Tech Avenue\nشارع التقنية ٤٥٦\nخیابان تکنولوژی ۴۵۶\n۴۵۶ ٹیک ایونیو\n\n',
641
+ 'Contact: +1-555-0123\nاتصال: +1-555-0123\nتماس: +1-555-0123\nرابطہ: +1-555-0123'
642
+ ]
643
+ }
644
+ ]
645
+ },
646
+
647
+ { text: '', margin: [0, 20] },
648
+
649
+ {
650
+ table: {
651
+ widths: ['*', '15%', '15%', '20%'],
652
+ headerRows: 1,
653
+ body: [
654
+ [
655
+ { text: 'Description\nالوصف\nشرح\nتفصیل', style: 'tableHeader' },
656
+ { text: 'Qty\nالكمية\nتعداد\nمقدار', style: 'tableHeader' },
657
+ { text: 'Price\nالسعر\nقیمت\nقیمت', style: 'tableHeader' },
658
+ { text: 'Total\nالإجمالي\nمجموع\nکل', style: 'tableHeader' }
659
+ ],
660
+ [
661
+ 'Web Development Services\nخدمات تطوير المواقع\nخدمات توسعه وب\nویب ڈیولپمنٹ سروسز',
662
+ '1',
663
+ '$5,000',
664
+ '$5,000'
665
+ ],
666
+ [
667
+ 'Mobile App Development\nتطوير تطبيقات الجوال\nتوسعه اپلیکیشن موبایل\nموبائل ایپ ڈیولپمنٹ',
668
+ '1',
669
+ '$8,000',
670
+ '$8,000'
671
+ ],
672
+ [
673
+ 'Database Design\nتصميم قاعدة البيانات\nطراحی پایگاه داده\nڈیٹابیس ڈیزائن',
674
+ '1',
675
+ '$3,000',
676
+ '$3,000'
677
+ ],
678
+ [
679
+ '',
680
+ '',
681
+ { text: 'Subtotal\nالمجموع الفرعي\nجمع جزئی\nذیلی کل', style: 'totalLabel' },
682
+ { text: '$16,000', style: 'totalAmount' }
683
+ ],
684
+ [
685
+ '',
686
+ '',
687
+ { text: 'Tax (10%)\nالضريبة (١٠٪)\nمالیات (۱۰٪)\nٹیکس (۱۰٪)', style: 'totalLabel' },
688
+ { text: '$1,600', style: 'totalAmount' }
689
+ ],
690
+ [
691
+ '',
692
+ '',
693
+ { text: 'TOTAL\nالإجمالي\nکل\nکل رقم', style: 'grandTotalLabel' },
694
+ { text: '$17,600', style: 'grandTotalAmount' }
695
+ ]
696
+ ]
697
+ },
698
+ layout: {
699
+ hLineWidth: function (i, node) {
700
+ return (i === 0 || i === node.table.body.length) ? 2 : 1;
701
+ },
702
+ vLineWidth: function (i, node) {
703
+ return (i === 0 || i === node.table.widths.length) ? 2 : 1;
704
+ }
705
+ }
706
+ },
707
+
708
+ { text: '', margin: [0, 30] },
709
+
710
+ {
711
+ text: [
712
+ { text: 'Payment Terms: ', style: 'paymentTerms' },
713
+ { text: 'شروط الدفع: ', style: 'paymentTerms' },
714
+ { text: 'شرایط پرداخت: ', style: 'paymentTerms' },
715
+ { text: 'ادائیگی کی شرائط: ', style: 'paymentTerms' },
716
+ 'Net 30 days - الدفع خلال ٣٠ يوماً - ۳۰ روز - ۳۰ دن\n\n',
717
+
718
+ { text: 'Thank you for your business! ', style: 'thankYou' },
719
+ { text: 'شكراً لتعاملكم معنا! ', style: 'thankYou' },
720
+ { text: 'از همکاری شما متشکریم! ', style: 'thankYou' },
721
+ { text: 'آپ کے کاروبار کے لیے شکریہ!', style: 'thankYou' }
722
+ ]
723
+ }
724
+ ],
725
+ styles: {
726
+ invoiceTitle: {
727
+ fontSize: 24,
728
+ bold: true,
729
+ color: '#2c3e50'
730
+ },
731
+ sectionHeader: {
732
+ fontSize: 12,
733
+ bold: true,
734
+ color: '#34495e'
735
+ },
736
+ tableHeader: {
737
+ bold: true,
738
+ fontSize: 11,
739
+ color: 'white',
740
+ fillColor: '#3498db',
741
+ alignment: 'center'
742
+ },
743
+ totalLabel: {
744
+ bold: true,
745
+ alignment: 'right'
746
+ },
747
+ totalAmount: {
748
+ bold: true,
749
+ alignment: 'right'
750
+ },
751
+ grandTotalLabel: {
752
+ bold: true,
753
+ fontSize: 12,
754
+ color: 'white',
755
+ fillColor: '#e74c3c',
756
+ alignment: 'right'
757
+ },
758
+ grandTotalAmount: {
759
+ bold: true,
760
+ fontSize: 12,
761
+ color: 'white',
762
+ fillColor: '#e74c3c',
763
+ alignment: 'right'
764
+ },
765
+ paymentTerms: {
766
+ fontSize: 10,
767
+ bold: true
768
+ },
769
+ thankYou: {
770
+ fontSize: 12,
771
+ italics: true,
772
+ color: '#27ae60'
773
+ }
774
+ },
775
+ defaultStyle: {
776
+ fontSize: 9,
777
+ lineHeight: 1.3
778
+ }
779
+ };
780
+
781
+ pdfMake.createPdf(docDefinition).download('multilingual-invoice.pdf');
782
+ showStatus('🧾 Multilingual invoice PDF generated successfully!');
783
+ }
784
+
785
+ // Employee directory
786
+ function generateEmployeeList() {
787
+ const docDefinition = {
788
+ content: [
789
+ { text: 'Employee Directory - دليل الموظفين - فهرست کارکنان - ملازمین کی فہرست',
790
+ style: 'title' },
791
+
792
+ { text: 'Contact Information - معلومات الاتصال - اطلاعات تماس - رابطے کی معلومات',
793
+ style: 'subtitle', margin: [0, 20, 0, 15] },
794
+
795
+ {
796
+ table: {
797
+ widths: ['20%', '25%', '20%', '15%', '20%'],
798
+ headerRows: 1,
799
+ body: [
800
+ [
801
+ { text: 'Name\nالاسم\nنام\nنام', style: 'tableHeader' },
802
+ { text: 'Department\nالقسم\nبخش\nشعبہ', style: 'tableHeader' },
803
+ { text: 'Position\nالمنصب\nسمت\nعہدہ', style: 'tableHeader' },
804
+ { text: 'Extension\nالرقم الداخلي\nداخلی\nایکسٹینشن', style: 'tableHeader' },
805
+ { text: 'Email\nالبريد الإلكتروني\nایمیل\nای میل', style: 'tableHeader' }
806
+ ],
807
+ [
808
+ 'أحمد عبدالله\nAhmed Abdullah\nاحمد عبدالله\nاحمد عبداللہ',
809
+ 'Information Technology\nتقنية المعلومات\nفناوری اطلاعات\nانفارمیشن ٹیکنالوجی',
810
+ 'CTO\nرئيس التقنية\nمدیر فنی\nسی ٹی او',
811
+ '1001',
812
+ 'ahmed.abdullah@company.com'
813
+ ],
814
+ [
815
+ 'فاطمة الزهراء\nFatima Al-Zahra\nفاطمه زهرا\nفاطمہ الزہراء',
816
+ 'Human Resources\nالموارد البشرية\nمنابع انسانی\nانسانی وسائل',
817
+ 'HR Manager\nمديرة الموارد البشرية\nمدیر منابع انسانی\nHR منیجر',
818
+ '1002',
819
+ 'fatima.zahra@company.com'
820
+ ],
821
+ [
822
+ 'محمد علی رضا\nMohammad Ali Reza\nمحمد علی رضا\nمحمد علی رضا',
823
+ 'Finance\nالمالية\nمالی\nمالیات',
824
+ 'CFO\nرئيس المالية\nمدیر مالی\nسی ایف او',
825
+ '1003',
826
+ 'mohammad.alireza@company.com'
827
+ ],
828
+ [
829
+ 'عائشة خان\nAisha Khan\nعایشه خان\nعائشہ خان',
830
+ 'Marketing\nالتسويق\nبازاریابی\nمارکیٹنگ',
831
+ 'Marketing Director\nمديرة التسويق\nمدیر بازاریابی\nمارکیٹنگ ڈائریکٹر',
832
+ '1004',
833
+ 'aisha.khan@company.com'
834
+ ],
835
+ [
836
+ 'عمر الفاروق\nOmar Al-Farooq\nعمر فاروق\nعمر الفاروق',
837
+ 'Sales\nالمبيعات\nفروش\nسیلز',
838
+ 'Sales Manager\nمدير المبيعات\nمدیر فروش\nسیلز منیجر',
839
+ '1005',
840
+ 'omar.farooq@company.com'
841
+ ],
842
+ [
843
+ 'زینب حسینی\nZainab Hosseini\nزینب حسینی\nزینب حسینی',
844
+ 'Quality Assurance\nضمان الجودة\nتضمین کیفیت\nکوالٹی ایشورنس',
845
+ 'QA Lead\nرئيسة ضمان الجودة\nسرپرست تضمین کیفیت\nQA لیڈ',
846
+ '1006',
847
+ 'zainab.hosseini@company.com'
848
+ ],
849
+ [
850
+ 'یوسف احمد\nYusuf Ahmad\nیوسف احمد\nیوسف احمد',
851
+ 'Customer Support\nدعم العملاء\nپشتیبانی مشتری\nکسٹمر سپورٹ',
852
+ 'Support Manager\nمدير الدعم\nمدیر پشتیبانی\nسپورٹ منیجر',
853
+ '1007',
854
+ 'yusuf.ahmad@company.com'
855
+ ]
856
+ ]
857
+ },
858
+ layout: {
859
+ hLineWidth: function (i, node) {
860
+ return (i === 0 || i === node.table.body.length) ? 2 : 1;
861
+ },
862
+ vLineWidth: function (i, node) {
863
+ return (i === 0 || i === node.table.widths.length) ? 2 : 1;
864
+ },
865
+ hLineColor: function (i, node) {
866
+ return (i === 0 || i === node.table.body.length) ? '#2c3e50' : '#ecf0f1';
867
+ },
868
+ vLineColor: function (i, node) {
869
+ return (i === 0 || i === node.table.widths.length) ? '#2c3e50' : '#ecf0f1';
870
+ },
871
+ fillColor: function (rowIndex, node, columnIndex) {
872
+ return (rowIndex % 2 === 0) ? '#f8f9fa' : null;
873
+ }
874
+ }
875
+ },
876
+
877
+ { text: '', margin: [0, 20] },
878
+
879
+ {
880
+ text: [
881
+ { text: 'Emergency Contacts - أرقام الطوارئ - تماس‌های اضطراری - ہنگامی رابطے', style: 'emergencyTitle' },
882
+ '\n\n',
883
+ 'Security: Ext. 9999 - الأمن: رقم داخلي ٩٩٩٩ - امنیت: داخلی ۹۹۹۹ - سکیورٹی: ایکسٹ ۹۹۹۹\n',
884
+ 'IT Help Desk: Ext. 8888 - مكتب المساعدة التقنية: رقم داخلي ٨٨٨٨ - میز کمک فنی: داخلی ۸۸۸۸ - IT ہیلپ ڈیسک: ایکسٹ ۸۸۸۸\n',
885
+ 'Reception: Ext. 0000 - الاستقبال: رقم داخلي ٠٠٠٠ - پذیرش: داخلی ۰۰۰۰ - ریسپشن: ایکسٹ ۰۰۰۰'
886
+ ]
887
+ }
888
+ ],
889
+ styles: {
890
+ title: {
891
+ fontSize: 20,
892
+ bold: true,
893
+ margin: [0, 0, 0, 10],
894
+ alignment: 'center',
895
+ color: '#2c3e50'
896
+ },
897
+ subtitle: {
898
+ fontSize: 14,
899
+ bold: true,
900
+ color: '#34495e'
901
+ },
902
+ tableHeader: {
903
+ bold: true,
904
+ fontSize: 10,
905
+ color: 'white',
906
+ fillColor: '#3498db',
907
+ alignment: 'center'
908
+ },
909
+ emergencyTitle: {
910
+ fontSize: 16,
911
+ bold: true,
912
+ color: '#e74c3c'
913
+ }
914
+ },
915
+ defaultStyle: {
916
+ fontSize: 9,
917
+ lineHeight: 1.3
918
+ },
919
+ pageMargins: [40, 60, 40, 60]
920
+ };
921
+
922
+ pdfMake.createPdf(docDefinition).download('employee-directory-multilingual.pdf');
923
+ showStatus('👥 Employee directory PDF generated successfully!');
924
+ }
925
+ </script>
926
+ </body>
927
+ </html>