osx - TCPDF generated PDF shows blank on Mac Preview and Safari -


but has no problem when opened in google chrome. when opened safari/preview, got blank page. zooming in/out nothing.

below code used generating pdf files:

require_once('../vendor/tecnickcom/tcpdf/tcpdf.php');  class mypdf extends tcpdf {     //page header     public function header() {         // current page break margin         $bmargin = $this->getbreakmargin();         // current auto-page-break mode         $auto_page_break = $this->autopagebreak;         // disable auto-page-break         $this->setautopagebreak(false, 0);         // set bacground image         $img_file = '../assets/img/background.jpg';         $this->image($img_file, 0, 0, 150, 90, '', '', '', false, 150, '', false, false, 0);         // restore auto-page-break status         $this->setautopagebreak($auto_page_break, $bmargin);         // set starting point page content         $this->setpagemark();     } }  $pdf = new mypdf('l', pdf_unit, [150, 90], true, 'utf-8');  $pdf->setcreator(pdf_creator); $pdf->setauthor('kent'); $pdf->settitle('title here'); $pdf->setsubject('subject here'); $pdf->settopmargin(44); $pdf->setprintfooter(false); $pdf->setautopagebreak(true, pdf_margin_bottom); $pdf->setimagescale(pdf_image_scale_ratio); $pdf->setfont('helvetica', '', 44); $pdf->addpage(); $pdf->writehtml('this content.', false, false, false, false, 'c'); $pdf->output(__dir__ . '/output.pdf', 'f'); 

2 reasons problem , first please use absolute path, secondly pdf not open in adobe acrobat either. because image missing icc profile . open photo , save again in photoshop or similar software.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -