Пример #1
0
 protected function _PDF_DOCUMENT($elem)
 {
     loadCommon('ixmlpdf');
     $pdf = new iXmlPdf('P', $elem['UNIT']);
     $pdf->pdf_ixml = $this;
     $pdf->setFontSubsetting(false);
     $pdf->SetDisplayMode($elem['ZOOM'], $elem['LAYOUT'], $elem['MODE']);
     $pdf->SetAuthor($elem['AUTHOR']);
     $pdf->SetCreator('iXML');
     $pdf->SetKeywords($elem['KEYWORDS']);
     $pdf->SetSubject($elem['SUBJECT']);
     $pdf->SetTitle($elem['TITLE']);
     if (isset($elem['PDF:SIGNATURE'])) {
         $child = $elem['PDF:SIGNATURE'][0];
         isset($child[SIGN_MAP]) and $child = $this->map($child);
         ($signcert = $child['SIGNCERT']) !== '' && stripos($signcert, 'file://') !== 0 && $pdf->setSignature($signcert, stripos($privatekey = $child['PRIVATEKEY'], 'file://') === 0 ? '' : $privatekey, $elem['PASSWORD'], ($extracerts = $child['EXTRACERTS']) === '' ? '' : 'data://application/x-pem-file;base64,' . base64_encode($extracerts));
     }
     isset($elem[SIGN_CHILD]) && $this->runStruct('PDF', $elem[SIGN_CHILD], $pdf);
     return $pdf->getPDFData();
 }
Пример #2
0
<?php

namespace Zeyon;

loadCommon('tcpdf/tcpdf');
// TCPDF before FPDI
loadCommon('fpdi/fpdi');
// -------------------- Implementation --------------------
class iXmlPdf extends \FPDI
{
    public $pdf_ixml;
    public $pdf_templates = [];
    public $pdf_header;
    public $pdf_footer;
    public $pdf_styles;
    public function pdf_run($elem, $styles = [])
    {
        $preserve = $this->pdf_styles;
        $this->pdf_setStyles($styles);
        $e = null;
        try {
            $this->pdf_ixml->runPdfContent($elem, $this);
        } catch (\Exception $e) {
        }
        $this->pdf_setStyles($preserve);
        if ($e) {
            throw $e;
        }
    }
    public function pdf_setStyles($styles = [])
    {