I have a issue of merging two pdf into one pdf. I am using FPDF + FPDI and also tried TCPDF + FPDI, However i had a problem when I am using pdf version > 1.4 The php error is : FPDF error: This document (pdf_dump/1407303457.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI.
I do not want to use the commercial plugin of fpdi. Is there any work around available to work with pdf > 1.4 version.
NB: I am using codeigniter
Thank you.
Have a look at this question.
You need to save your PDF as an earlier version, PDF 1.4 or lower, and then it should hopefully work with FPDF.
You can try the TCPDI Parser, it is a modified version of FPDI which should support PDF version > 1.4
For symfony, I used this lib to convert pdf>1.4 to pdf1.4 :
https://packagist.org/packages/xthiago/pdf-version-converter
Related
I am using SSRS version 15.0.1102.897. When I generate PDF files using this version the PDF gets set to version 1.7.
I have another instance of SSRS running version 13.0.2216.0 and when I generate PDF files using this version, the PDF gets set to version 1.3.
The issue I'm running into is that I'm using a FPDI PDF-Parser Library to merge the generated files together but this library only supports up to PDF version 1.4 for merging.
Is there a way to force the generated PDF in the v15 SSRS instance to be PDF version 1.3 or 1.4 instead of 1.7?
Thanks in advance
Looking through RSReportServer.Config description that value seems not to be accessible (pun) to configurators.
SSRS as you note is now designed for features found in version 1.7 upwards but may work primarily using 1.3 compatible objects.
The simplest solution may be to use a binary/hex patchier to replace the 8 bytes %PDF-1.7 header string with %PDF-1.3 (do NOT use an ascii string find and replace such as sed/grep), if you want to try the dirty way you need either https://sourceforge.net/projects/bbe- or other equivalent to hexdump then modify then hex2bin and verify no byte change in file size (not even one byte +/- since the trailer would be corrupted)
However there is no guarantee that any 1.5 or above objects will not break FPDI so for best compatibility you could parse through Ghostscript to "down-level"
for more details see related question and old link here https://stackoverflow.com/a/51002675/10802527
Do follow the link to iconic blog but the modern command line can be shorter so try the traditional
<?php
exec('gs -sDEVICE=pdfwrite -o="'.$srcfile_new.'" "'.$srcfile.'"');
?>
and also try for comparison using 9.55 additional -dNEWPDF
i used dompdf as php pdf library with codeigniter project but it doesn't support css float property. But i need this property supported free pdf library.
And other hand if i use lot of table then it takes to much time to generate pdf.
in its latest version (which is 0.6 beta 3) you can enable it in the config. It's still experimental but it worked fine for me
Look at this answer of mine
cezpdf is alternative and easy to use
cezPDF in Codeigniter 2
Also here is a simple tutorial to use it
http://www.christophermonnat.com/2008/08/generating-pdf-files-using-codeigniter/
I'm faced with having to generate some fairly basic PDFs on a server which is running php 4.3.2 unfortunately.
So that pretty much renders most things impossible such as google's domPDF etc.. PDFlib is not compiled in so I can't use any of that either.
Does anyone have any suggestions?
Thanks!
use this R&OS PDF Class to achieve this task.. This is fairly simple and light weight class and requires no module etc to be installed on the server.
You could try out DocRaptor.com, which is a webservice that will let you convert html to pdf.
I ended up using an older version of fpdf and HTML2PDF (from the link below.) It's certainly not ideal, but then neither is a 7 year old version of php.
http://www.macronimous.com/resources/Converting_HTML2PDF_using_PHP.asp
You didn't mention if you were generating these from scratch or from existing PDF data. pdftk is a handy PDF manipulation library. You can shell out to it from PHP.
I need to dinamicaly generate a PDF from HTML, but I have PDF Support disabled on my hosting, so is it possible to do without PDFlib GmbH library?
Thanks
There are many packages, but as I gather you're not able to install extra libs on your hosting. Options would be FPDF if you feel like rewriting your whole HTML into blocks, TCPDF if you feel a bit less masochistic, which has some limited html/css support.
The most common alternative is FPDF. It is pure PHP and needs no installed extensions.
An other nice option is dompdf, which is a HTML to PDF converter and is (almost) CSS 2.1 compliant. It can be used either using PDFLib or the R&OS CPDF class
You could also checkout htmldoc:
Project page
I am trying to add an existing PDF (created otherwise) to a PDF created with FPDF using FPDI. It seems to work find for most PDFs, but I get the following error:
FPDF error: Unable to find xref table.
After some testing, I figured out that if I use a PDF version of 1.4 or lower (Acrobat v5 or lower) it seems to work. Looking at the file it seems to be because of a different PDF format.
Is there a work around or solution to this? I have probably 10 000+ PDFs uploaded by users, some of the new working, some of them not. It's also annoying that FPDI just dies instead of causing some kind of error or even returning false
The only solution I can think of right now is to parse the first line of the PDF file to determine the version and only add the ones that over versions that will work.
Edit:
I also tried this in Zend_Pdf and it had the following result, using the demo file that comes with the Zend Framework:
Fatal error: Uncaught exception 'Zend_Pdf_Exception' with message 'Cross-reference streams are not supported yet.' in /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf/Parser.php:331
Stack trace:
#0 /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf/Parser.php(455): Zend_Pdf_Parser->_loadXRefTable('116')
#1 /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf.php(297): Zend_Pdf_Parser->__construct('/Volumes/Docume...', Object(Zend_Pdf_ElementFactory_Proxy), true)
#2 /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf.php(250): Zend_Pdf->__construct('/Volumes/Docume...', NULL, true)
#3 /Volumes/Documents/temp/ZendFramework-1.7.7/demos/Zend/Pdf/demo.php(37): Zend_Pdf::load('/Volumes/Docume...')
#4 {main}
thrown in /Volumes/Documents/temp/ZendFramework-1.7.7/library/Zend/Pdf/Parser.php on line 331
Is it impossible to parse PDFs greater than 1.4?
You can use FPDI with TCPDF, it will generate and read (with FPDI) version 1.7 PDFs.
See TCPDF - PHP class for PDF.
EDIT
I have recently been challenged with the issue of using various versions and formats of PDF with FPDI and TCPDF, and I can confirm that PDF versions above 1.4 are hit and miss, the interesting thing is that I have a lot of working 1.7 PDFs, and works about 50/50 on 1.5 and 1.6.
I worked around the issue by converting all non-workable PDF files to v1.4 using GhostScript which you can exec from the command line. Use ps2pdf14 from the GhostScript lib folder.
I've just released a pair of projects (TCPDI / tcpdi_parser, based on FPDI and tcpdf_parser, respectively) which work with TCPDF 6 (and FPDF_TPL) to import PDFs above v1.4 (tested up to 1.6 so far, but I'll make sure it works with 1.7 once I find a 1.7 PFD to test it with!) without requiring any commercial addons. Basic installation and usage instructions can be found in the TCPDI README; please feel free to try it out and report any issues via the Github tracker.
Setasign is offering a PDF parser as a commercial addon to FPDI. We had no troubles parsing PDF files up to version 1.7 so far using the new parser.
I found that using commerical version of FPDI PDF-Parser solved my problem. I've been using it for a year now and haven't had any PDFs it couln't parse (unless the PDF was corrupt or had something else weird going on).
for symfony, I used this lib to convert >1.4
https://packagist.org/packages/xthiago/pdf-version-converter
If you have Acrobat PDF writer, you can manipulate the job settings to make the PDF you are printing/savingAs to be compatible to PDF 1.4. For the tiny reason I need this product, it doesn't seem worth the 100 euros to get the commercial version that is compatible to versions greater than 1.4.
my team had removed some part of the code. we stopped the code from adding watermark to the pdf. this solved the problem for us. PDF >= 1.5