fpdi

How to skip over corrupt files with PHP libraries TCPDF and FPDI by modifying error handling?

大兔子大兔子 提交于 2019-12-10 18:22:36
问题 I am using the PHP libraries TCPDF and FPDI to combine PDF documents, and am getting the following error: TCPDF ERROR: Unable to find object (10, 0) at expected location I have the commercial version of FPDI. It appears that the issue is only happening with PDF Version 1.3 (Acrobat 4.x) files. Here is a screenshot of a file's document properties that is creating the error. http://imagebin.org/215041 I'd like to skip over any files with errors instead of letting the script die. I have modified

FPDI/FPDF: Watermark and Print Multiple Pages

走远了吗. 提交于 2019-12-09 04:27:21
问题 I modified this stack question: Applying watermarks on pdf files when users try to download the files but I encountered an error, though there was a comment that says on how to fix it, it wasn't elaborate enough. Here is the code: require_once('fpdf/fpdf.php'); require_once('fpdi/fpdi.php'); class WaterMark { public $pdf, $file, $newFile, $wmText = "STACKOVERFLOW"; /** $file and $newFile have to include the full path. */ public function __construct($file, $newFile) { $this->pdf = new FPDI();

Import a PDF and sign it with Symfony

妖精的绣舞 提交于 2019-12-08 06:09:25
问题 I need to sign an existing pdf. I'm using Symfony 3.4.12 and the bundle https://packagist.org/packages/whiteoctober/tcpdf-bundle to sign pdf's. Inside the services I added this part: AppBundle\Controller\AController: class: AppBundle\Controller\AController arguments: ['@white_october.tcpdf'] Inside the Controller I'm using this; use WhiteOctober\TCPDFBundle\Controller\TCPDFController; And with this code I can download a created pdf signed correctly: private $tcpdf; public function __construct

PHP: How to combine these two classes?

旧巷老猫 提交于 2019-12-07 05:38:54
问题 Just like the title says I am having problems combining two classes. Altough this is about FPDF, i do think this is a regular question, since the question could have been about any script. I am using FPDF to create PDF-documents on the fly. I use it in combination with the FPDI class to add vector images to the PDF file. The script can be found below and works like a charm. <?php // Add FPDF to generate PDF files require_once('../fpdf16/fpdf.php'); // Add FPDI to add the functionality of

Can FPDF/FPDI use a PDF in landscape format as a template?

匆匆过客 提交于 2019-12-03 16:44:50
问题 I am trying to import an existing PDF as a template with FPDI. The template is in landscape format. If I import the template into a new document the template page is inserted in portrait form with the content rotated 90 degrees. If my new document is in portrait the full content appears, but if the new document is also landscape, the content is cropped. Is it possible to use a landscape template with FPDI? 回答1: sure, it is no problem. Just add "L" as parameter when calling "addPage()". Here

Can FPDF/FPDI use a PDF in landscape format as a template?

ぃ、小莉子 提交于 2019-12-03 05:49:12
I am trying to import an existing PDF as a template with FPDI. The template is in landscape format. If I import the template into a new document the template page is inserted in portrait form with the content rotated 90 degrees. If my new document is in portrait the full content appears, but if the new document is also landscape, the content is cropped. Is it possible to use a landscape template with FPDI? sure, it is no problem. Just add "L" as parameter when calling "addPage()". Here is a sample which works fine for me (the template is in landscape) <?php require_once('fpdf.php'); require

FPDF/FPDI UseTemplate

早过忘川 提交于 2019-12-02 08:12:34
问题 I'm using FPDI & FPDF to overlay new text on top of an existing PDF. It uses the useTemplate() method to achieve this. Problem I'm having - it only applies the template to the first page. If the text is long, it will wrap to a second page, using the SetAutoPageBreak() method. How can I make it apply the template on every page? 回答1: I've cracked it. Looking into the code, I realised that even the SetAutoPageBreak() routine calls AddPage() internally, giving me the hook I needed to include my

FPDF/FPDI UseTemplate

你。 提交于 2019-12-02 07:10:18
I'm using FPDI & FPDF to overlay new text on top of an existing PDF. It uses the useTemplate() method to achieve this. Problem I'm having - it only applies the template to the first page. If the text is long, it will wrap to a second page, using the SetAutoPageBreak() method. How can I make it apply the template on every page? I've cracked it. Looking into the code, I realised that even the SetAutoPageBreak() routine calls AddPage() internally, giving me the hook I needed to include my template on every page. So, I extended the base FPDI class and over-rode the AddPage() method, including the

Edit Existing PDF multiple page File using FPDF & FPDI

▼魔方 西西 提交于 2019-11-30 16:35:34
I am usinf FPDI to edit my existing pdf file and its work perfect for single page. As ou can see i am editing my $tplIdx = $pdf->importPage(1); first page. I have six page pdf file and need to add 2 variable in different page. Is is possible ? How? <?php require_once('fpdf.php'); require_once('fpdi.php'); // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('ex.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at point 10,10 with a width of 100 mm $pdf->useTemplate($tplIdx, 10, 10, 200); // now

Edit Existing PDF multiple page File using FPDF & FPDI

六月ゝ 毕业季﹏ 提交于 2019-11-30 16:16:46
问题 I am usinf FPDI to edit my existing pdf file and its work perfect for single page. As ou can see i am editing my $tplIdx = $pdf->importPage(1); first page. I have six page pdf file and need to add 2 variable in different page. Is is possible ? How? <?php require_once('fpdf.php'); require_once('fpdi.php'); // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage(); // set the sourcefile $pdf->setSourceFile('ex.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported