Lines Matching defs:mpdf

21 	private $mpdf;
43 public function __construct(Mpdf $mpdf, BaseWriter $writer, Form $form, Protection $protection, LoggerInterface $logger)
45 $this->mpdf = $mpdf;
55 $this->mpdf->MetadataRoot = $this->mpdf->n;
56 $Producer = 'mPDF' . ($this->mpdf->exposeVersion ? (' ' . Mpdf::VERSION) : '');
68 if (!empty($this->mpdf->keywords)) {
69 $m .= ' <pdf:Keywords>' . $this->mpdf->keywords . '</pdf:Keywords>' . "\n";
77 if (!empty($this->mpdf->creator)) {
78 $m .= ' <xmp:CreatorTool>' . $this->mpdf->creator . '</xmp:CreatorTool>' . "\n";
85 if (!empty($this->mpdf->title)) {
88 <rdf:li xml:lang="x-default">' . $this->mpdf->title . '</rdf:li>
92 if (!empty($this->mpdf->keywords)) {
95 <rdf:li>' . $this->mpdf->keywords . '</rdf:li>
99 if (!empty($this->mpdf->subject)) {
102 <rdf:li xml:lang="x-default">' . $this->mpdf->subject . '</rdf:li>
106 if (!empty($this->mpdf->author)) {
109 <rdf:li>' . $this->mpdf->author . '</rdf:li>
115 if (!empty($this->mpdf->additionalXmpRdf)) {
116 $m .= $this->mpdf->additionalXmpRdf;
120 if ($this->mpdf->PDFX) {
123 elseif ($this->mpdf->PDFA) {
125 if (strpos($this->mpdf->PDFAversion, '-') === false) {
126 throw new \Mpdf\MpdfException(sprintf('PDFA version (%s) is not valid. (Use: 1-B, 3-B, etc.)', $this->mpdf->PDFAversion));
129 list($part, $conformance) = explode('-', strtoupper($this->mpdf->PDFAversion));
153 $this->writer->write('/Producer ' . $this->writer->utf16BigEndianTextString('mPDF' . ($this->mpdf->exposeVersion ? (' ' . $this->getVersionString()) : '')));
155 if (!empty($this->mpdf->title)) {
156 $this->writer->write('/Title ' . $this->writer->utf16BigEndianTextString($this->mpdf->title));
159 if (!empty($this->mpdf->subject)) {
160 $this->writer->write('/Subject ' . $this->writer->utf16BigEndianTextString($this->mpdf->subject));
163 if (!empty($this->mpdf->author)) {
164 $this->writer->write('/Author ' . $this->writer->utf16BigEndianTextString($this->mpdf->author));
167 if (!empty($this->mpdf->keywords)) {
168 $this->writer->write('/Keywords ' . $this->writer->utf16BigEndianTextString($this->mpdf->keywords));
171 if (!empty($this->mpdf->creator)) {
172 $this->writer->write('/Creator ' . $this->writer->utf16BigEndianTextString($this->mpdf->creator));
175 foreach ($this->mpdf->customProperties as $key => $value) {
182 if ($this->mpdf->PDFX) {
191 $this->mpdf->OutputIntentRoot = $this->mpdf->n;
194 $ICCProfile = str_replace('_', ' ', basename($this->mpdf->ICCProfile, '.icc'));
196 if ($this->mpdf->PDFA) {
198 if ($this->mpdf->ICCProfile) {
207 $this->writer->write('/DestOutputProfile ' . ($this->mpdf->n + 1) . ' 0 R');
208 } elseif ($this->mpdf->PDFX) { // always a CMYK profile
210 if ($this->mpdf->ICCProfile) {
214 $this->writer->write('/DestOutputProfile ' . ($this->mpdf->n + 1) . ' 0 R');
225 if ($this->mpdf->PDFX && !$this->mpdf->ICCProfile) {
231 if ($this->mpdf->ICCProfile) {
232 if (!file_exists($this->mpdf->ICCProfile)) {
233 throw new \Mpdf\MpdfException(sprintf('Unable to find ICC profile "%s"', $this->mpdf->ICCProfile));
235 $s = file_get_contents($this->mpdf->ICCProfile);
240 if ($this->mpdf->compress) {
246 if ($this->mpdf->PDFX || ($this->mpdf->PDFA && $this->mpdf->restrictColorSpace === 3)) {
252 if ($this->mpdf->compress) {
268 foreach ($this->mpdf->associatedFiles as $k => $file) {
271 $this->mpdf->associatedFiles[$k]['_root'] = $this->mpdf->n; // we store the root ref of object for future reference (e.g. /EmbeddedFiles catalog)
278 $this->writer->write('/F ' . ($this->mpdf->n + 1) . ' 0 R');
279 $this->writer->write('/UF ' . ($this->mpdf->n + 1) . ' 0 R');
321 foreach ($this->mpdf->associatedFiles as $file) {
327 $this->mpdf->associatedFilesRoot = $this->mpdf->n;
335 if ($this->mpdf->ZoomMode === 'fullpage') {
337 } elseif ($this->mpdf->ZoomMode === 'fullwidth') {
339 } elseif ($this->mpdf->ZoomMode === 'real') {
341 } elseif (!is_string($this->mpdf->ZoomMode)) {
342 $this->writer->write('/OpenAction [3 0 R /XYZ null null ' . ($this->mpdf->ZoomMode / 100) . ']');
343 } elseif ($this->mpdf->ZoomMode === 'none') {
349 if ($this->mpdf->LayoutMode === 'single') {
351 } elseif ($this->mpdf->LayoutMode === 'continuous') {
353 } elseif ($this->mpdf->LayoutMode === 'twoleft') {
355 } elseif ($this->mpdf->LayoutMode === 'tworight') {
357 } elseif ($this->mpdf->LayoutMode === 'two') {
358 if ($this->mpdf->mirrorMargins) {
366 if (count($this->mpdf->BMoutlines) > 0) {
367 $this->writer->write('/Outlines ' . $this->mpdf->OutlineRoot . ' 0 R');
372 if (is_int(strpos($this->mpdf->DisplayPreferences, 'FullScreen'))) {
377 if ($this->mpdf->PDFA || $this->mpdf->PDFX) {
378 $this->writer->write('/Metadata ' . $this->mpdf->MetadataRoot . ' 0 R');
382 if ($this->mpdf->PDFA || $this->mpdf->PDFX || $this->mpdf->ICCProfile) {
383 $this->writer->write('/OutputIntents [' . $this->mpdf->OutputIntentRoot . ' 0 R]');
387 if ($this->mpdf->associatedFilesRoot) {
388 $this->writer->write('/AF '. $this->mpdf->associatedFilesRoot .' 0 R');
391 foreach ($this->mpdf->associatedFiles as $file) {
402 if ($this->mpdf->js !== null) {
403 $this->writer->write('/Names << /JavaScript ' . $this->mpdf->n_js . ' 0 R >> ');
406 if ($this->mpdf->DisplayPreferences || $this->mpdf->directionality === 'rtl' || $this->mpdf->mirrorMargins) {
410 if (is_int(strpos($this->mpdf->DisplayPreferences, 'HideMenubar'))) {
414 if (is_int(strpos($this->mpdf->DisplayPreferences, 'HideToolbar'))) {
418 if (is_int(strpos($this->mpdf->DisplayPreferences, 'HideWindowUI'))) {
422 if (is_int(strpos($this->mpdf->DisplayPreferences, 'DisplayDocTitle'))) {
426 if (is_int(strpos($this->mpdf->DisplayPreferences, 'CenterWindow'))) {
430 if (is_int(strpos($this->mpdf->DisplayPreferences, 'FitWindow'))) {
435 if (!$this->mpdf->PDFA && !$this->mpdf->PDFX && is_int(strpos($this->mpdf->DisplayPreferences, 'NoPrintScaling'))) {
439 if ($this->mpdf->directionality === 'rtl') {
444 if ($this->mpdf->mirrorMargins && !$this->mpdf->PDFA && !$this->mpdf->PDFX) {
445 // if ($this->mpdf->DefOrientation=='P') $this->writer->write('/Duplex /DuplexFlipShortEdge');
452 if ($this->mpdf->open_layer_pane && ($this->mpdf->hasOC || count($this->mpdf->layers))) {
456 if ($this->mpdf->hasOC || count($this->mpdf->layers)) {
460 if ($this->mpdf->hasOC) {
462 if (($this->mpdf->hasOC & 1) === 1) {
463 $p = $this->mpdf->n_ocg_print . ' 0 R';
466 if (($this->mpdf->hasOC & 2) === 2) {
467 $v = $this->mpdf->n_ocg_view . ' 0 R';
470 if (($this->mpdf->hasOC & 4) === 4) {
471 $h = $this->mpdf->n_ocg_hidden . ' 0 R';
477 if (count($this->mpdf->layers)) {
478 foreach ($this->mpdf->layers as $k => $layer) {
479 if (isset($this->mpdf->layerDetails[$k]) && strtolower($this->mpdf->layerDetails[$k]['state']) === 'hidden') {
504 $nb = $this->mpdf->page;
508 if (isset($this->mpdf->PageLinks[$n]) || isset($this->mpdf->PageAnnots[$n]) || count($this->form->forms) > 0) {
510 $wPt = $this->mpdf->pageDim[$n]['w'] * Mpdf::SCALE;
511 $hPt = $this->mpdf->pageDim[$n]['h'] * Mpdf::SCALE;
514 if (isset($this->mpdf->PageLinks[$n])) {
516 foreach ($this->mpdf->PageLinks[$n] as $key => $pl) {
524 // Removed as causing undesired effects in Chrome PDF viewer https://github.com/mpdf/mpdf/issues/283
539 if ($this->mpdf->PDFA || $this->mpdf->PDFX) {
546 // $h=isset($this->mpdf->OrientationChanges[$p]) ? $wPt : $hPt;
547 $htarg = $this->mpdf->pageDim[$p]['h'] * Mpdf::SCALE;
556 $l = $this->mpdf->links[$pl[4]];
558 if (isset($this->mpdf->pageDim[$l[0]]['h'])) {
559 $htarg = $this->mpdf->pageDim[$l[0]]['h'] * Mpdf::SCALE;
561 $htarg = $this->mpdf->h * Mpdf::SCALE;
574 if (isset($this->mpdf->PageAnnots[$n])) {
576 foreach ($this->mpdf->PageAnnots[$n] as $key => $pl) {
580 if ($fileAttachment && !$this->mpdf->allowAnnotationFiles) {
591 if ($this->mpdf->annotMargin != 0 || $x == 0 || $x < 0) { // Odd page, intentional non-strict comparison
592 $x = ($wPt / Mpdf::SCALE) - $this->mpdf->annotMargin;
624 $annot .= '/EF <</F ' . ($this->mpdf->n + 1) . ' 0 R>>';
644 if ($this->mpdf->PDFA || $this->mpdf->PDFX) {
691 if (!$this->mpdf->PDFA && !$this->mpdf->PDFX && isset($pl['opt']['subj'])) {
696 $annot .= ' /Popup ' . ($this->mpdf->n + 1) . ' 0 R';
749 if ($this->mpdf->PDFA || $this->mpdf->PDFX) {
752 $annot .= ' /Parent ' . ($this->mpdf->n - 1) . ' 0 R';
792 $this->writer->write('/Size ' . ($this->mpdf->n + 1));
793 $this->writer->write('/Root ' . $this->mpdf->n . ' 0 R');
794 $this->writer->write('/Info ' . $this->mpdf->InfoRoot . ' 0 R');
796 if ($this->mpdf->encrypted) {
797 $this->writer->write('/Encrypt ' . $this->mpdf->enc_obj_id . ' 0 R');
800 $uniqid = md5(time() . $this->mpdf->buffer);