tcpdf - PHP code to read and delete page from pdf file -


i have system generates pdf files, each file consists of 2 pages. reason need write php code can delete second page each pdf file. herer i've done , results:

1- used tcpdf library write folowing code:

require_once('tcpdf-master/examples/tcpdf_include.php'); require_once('tcpdf-master/tcpdf_import.php');  $pdf = new tcpdf_import( 'test.pdf' ); if (@file_exists(dirname(__file__).'/lang/eng.php')) {     require_once(dirname(__file__).'/lang/eng.php');     $pdf->setlanguagearray($l); } $pdf->deletepage(2); $pdf->output('test_output.pdf', 'i'); 

the result: blank 1 page pdf file. in other words, content original file not available in new file

2- used fpdf , fpdi libraries read 1 page original file.

require_once('fpdf-master/fpdf.php'); require_once('fpdi-1.6.1/fpdi.php');  $pdf = new fpdi();  $pagecount = $pdf->setsourcefile('test.pdf'); $tplidx = $pdf->importpage(1, '/mediabox');  $pdf->addpage(); $pdf->usetemplate($tplidx, 10, 10, 90);  $pdf->output(); 

the result error message:

uncaught exception 'exception' message 'this document (test.pdf) uses compression technique not supported free parser shipped fpdi. (see https://www.setasign.com/fpdi-pdf-parser more details)' in c:\wamp\www\fpdi-1.6.1\pdf_parser.php on line 322

anybody knows how please??


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -