2016-07-28 2 views
0

Google 크롬에서는 열 때 문제가 없습니다. Safari/Preview로 열면 빈 페이지가 나타납니다. 확대/축소는 아무 것도하지 않습니다. 둘째로 당신의 PDF 어느 어도비 Acrobat에서 열리지 않습니다,이 문제에 대한TCPDF 생성 된 PDF는 Mac 미리보기 및 Safari에서 공백으로 표시됩니다.

require_once('../vendor/tecnickcom/tcpdf/tcpdf.php'); 

class MYPDF extends TCPDF { 
    //Page header 
    public function Header() { 
     // get the current page break margin 
     $bMargin = $this->getBreakMargin(); 
     // get 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 the starting point for the 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 is the content.', false, false, false, false, 'C'); 
$pdf->Output(__DIR__ . '/output.pdf', 'F'); 

답변

0

2 이유로, 첫째 절대 경로를 사용하십시오 : 아래

내가 PDF 파일을 생성하기 위해 사용되는 코드입니다. 그것은 귀하의 이미지에 icc 프로파일이 없기 때문입니다. 사진을 열고 Photoshop 또는 유사한 소프트웨어에 다시 저장하십시오.

관련 문제