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
Post a Comment