* @copyright 2002-2026 Nicola Asuni - Tecnick.com LTD * @license https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE) * @link https://github.com/tecnickcom/tc-lib-pdf * * This file is part of tc-lib-pdf software library. */ // NOTE: local file reads (images, fonts, attachments) are restricted to an allowlist of // trusted paths that covers this package tree, so run the examples in place. To read assets // from other locations, list them in the 'allowedPaths' entry of the fileOptions constructor // parameter (see E047_remote_resources_security.php). // NOTE: run make fonts in the project root to generate the dependencies and example fonts. // autoloader when using Composer require __DIR__ . '/../vendor/autoload.php'; // define fonts directory \define('K_PATH_FONTS', \realpath(__DIR__ . '/../vendor/tecnickcom/tc-lib-pdf-font/target/fonts')); // autoloader when using RPM or DEB package installation //require ('/usr/share/php/Com/Tecnick/Pdf/autoload.php'); // main TCPDF object $pdf = new \Com\Tecnick\Pdf\Tcpdf( unit: \Com\Tecnick\Pdf\Page\Unit::Millimeter, isunicode: true, subsetfont: false, compress: true, mode: \Com\Tecnick\Pdf\PdfConformance::None, objEncrypt: null, ); // ---------- $pdf->setCreator('tc-lib-pdf'); $pdf->setAuthor('Nicola Asuni'); $pdf->setSubject('tc-lib-pdf example: 046'); $pdf->setTitle('Pangrams'); $pdf->setKeywords('TCPDF tc-lib-pdf example pangrams unicode multilingual'); $pdf->setPDFFilename('046_pangrams.pdf'); $pdf->setViewerPreferences(['DisplayDocTitle' => true]); $pdf->enableDefaultPageContent(false); // unifont covers the full Unicode BMP including Arabic, Hebrew, Thai, // Devanagari, Hangul, and CJK Unified Ideographs. $bfont = $pdf->font->insert($pdf->pon, 'unifont', '', 14); $page = $pdf->addPage(['format' => 'A4']); $pdf->page->addContent($bfont['out']); $html = '

Pangrams

'; // English $html .= '

English

'; $html .= '

The quick brown fox jumps over the lazy dog.

'; // Arabic (RTL) $html .= '

Arabic (العربية)

'; $html .= '
' . 'صِف خَلقَ خَودِكِ كَمِثلِ الشَّمسِ إِذ بَزَغَت' . ' — يَحظى الضَّجيعُ بِها نَجلاءَ مِعطارِ' . '
'; // Hebrew (RTL) $html .= '

Hebrew (עברית)

'; $html .= '
' . 'דג סקרן שט בים מאוכזב ולפתע מצא חברה' . '
'; // Thai $html .= '

Thai (ภาษาไทย)

'; $html .= '

' . 'เป็นมนุษย์สุดประเสริฐเลิศคุณค่า' . ' กว่าบรรดาฝูงสัตว์เดรัจฉาน' . ' จงฝ่าฟันพัฒนาวิชาการ' . ' อย่าล้างผลาญฤๅเข่นฆ่าบีฑาใคร' . '

'; // Devanagari (Hindi) $html .= '

Devanagari (देवनागरी)

'; $html .= '

' . 'ऋषि सुयश ने प्रख्यात ग्रंथ की रचना करके हमें ज्ञान दिया।' . '

'; // Hangul (Korean) $html .= '

Hangul (한글)

'; $html .= '

' . '키스의 고유조건은 입술끼리 만나야 하고' . ' 특별한 기술은 필요치 않다' . '

'; // Greek $html .= '

Greek (Ελληνικά)

'; $html .= '

' . 'Ξεσκεπάζω την ψυχοφθόρα βδελυγμία.' . '

'; // Japanese $html .= '

Japanese (日本語)

'; $html .= '

' . 'いろはにほへと ちりぬるを わかよたれそ つねならむ' . ' うゐのおくやま けふこえて あさきゆめみし ゑひもせす' . '

'; // Russian $html .= '

Russian (Русский)

'; $html .= '

' . 'Съешь же ещё этих мягких французских булок, да выпей чаю.' . '

'; // Armenian $html .= '

Armenian (Հայերեն)

'; $html .= '

' . 'Բոլոր մարդիկ ծնվում են ազատ և հավասար իրենց արժանապատ­վությամբ և իրա­վուն­քնե­րով։' . '

'; // Georgian $html .= '

Georgian (ქართული)

'; $html .= '

' . 'გთხოვთ ახლავე გაიაროთ რეგისტრაცია უფასო პროგრამაზე.' . '

'; // Tamil $html .= '

Tamil (தமிழ்)

'; $html .= '

' . 'யாமறிந்த மொழிகளிலே தமிழ்மொழி போல் இனிதாவது எங்கும் காணோம்.' . '

'; // Bengali $html .= '

Bengali (বাংলা)

'; $html .= '

' . 'সুপ্রিয় বন্ধুগণ, আমরা বাংলা ভাষায় কথা বলি।' . '

'; // Amharic $html .= '

Amharic (አማርኛ)

'; $html .= '

' . 'ሰው ናቸው ወይስ ሃሳቤን ሳልጨርስ ትዕዛዙን ሰጡ?' . '

'; // Khmer $html .= '

Khmer (ភាសាខ្មែរ)

'; $html .= '

' . 'ខ្ញុំអាចញ៉ាំកញ្ចក់បានដោយគ្មានបញ្ហា។' . '

'; // Tibetan $html .= '

Tibetan (བོད་སྐད།)

'; $html .= '

' . 'ང་གཤེགས་ཀྱི་ཡིག་གུ་ཟ་ཐུབ་ཀྱི་ཡོད། དེས་ང་ལ་གནོད་པ་མི་བྱེད།' . '

'; // Chinese (Traditional — Thousand Character Classic) $html .= '

Chinese (中文)

'; $html .= '

' . '天地玄黄,宇宙洪荒。日月盈昃,辰宿列张。' . '寒来暑往,秋收冬藏。闰余成岁,律吕调阳。' . '

'; $pdf->addHTMLCell(html: $html, posx: 10, posy: 10, width: 190); // ============================================================= $rawpdf = $pdf->getOutPDFString(); $pdf->renderPDF(rawpdf: $rawpdf);