다운로드 할 때 모든 페이지에 텍스트를 추가해야하는 내 서버에 pdfs 은행이 있습니다. 나는 fpdf를 사용하여 파일을 열어보고, 각 페이지에 텍스트를 추가하고, 파일을 닫고 브라우저에 서비스를 제공합니다. 내가이 작업을 수행 할 수 있다면 나는 그 때 추가하는 데 필요한 순간에fpdf를 사용하여 PHP의 기존 pdf 수정
$pdf = new FPDI();
$pdf->setSourceFile($filename);
// import page 1
$tplIdx = $pdf->importPage(1);
//use the imported page and place it at point 0,0; calculate width and height
//automaticallay and ajust the page size to the size of the imported page
$pdf->useTemplate($tplIdx, 0, 0, 0, 0, true);
// now write some text above the imported page
$pdf->SetFont('Arial', '', '13');
$pdf->SetTextColor(0,0,0);
//set position in pdf document
$pdf->SetXY(20, 20);
//first parameter defines the line height
$pdf->Write(0, 'gift code');
//force the browser to download the output
$pdf->Output('gift_coupon_generated.pdf', 'D');
header("location: ".$filename);
이 바로 PDF의 아무 곳이나 텍스트를 넣어 저장하려고하지만 오류
FPDF error: You have to add a page first!
를 얻을 수 문서보다는 1이 아니라이 작업을 수행하는 방법을 잘 모든 페이지에있는 텍스트는 다음 문서
$ x & $ y'$ outPdf-> useTemplate ($ outPdf-> importPage ($ i), null, null, 0, 0, true); '에서 Null을 사용할 때만 효과가있었습니다. 그렇지 않으면 페이지를 A4로 자릅니다. – juanmf