0

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.

Somnath Paul
  • 190
  • 1
  • 6
  • 17

2 Answers2

1

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

Community
  • 1
  • 1
Erlesand
  • 1,525
  • 12
  • 16
  • I saw it, but I am developing the website and other people will be using it. I cannot request other users to save PDF to earlier version and upload. Hope you understand my situation !! – Somnath Paul Aug 06 '14 at 18:14
  • I shall try TCPDI Parser and let me see if it works for version > 1.4 – Somnath Paul Aug 06 '14 at 18:19
  • It is not working. It is giving an error on using. Fatal error: Uncaught exception 'Exception' with message 'TCPDF_PARSER ERROR: decodeFilterFlateDecode: invalid code' in C:\wamp\www\pdftest\tcpdf\include\tcpdf_filters.php on line 474 Exception: TCPDF_PARSER ERROR: decodeFilterFlateDecode: invalid code in C:\wamp\www\pdftest\tcpdf\include\tcpdf_filters.php on line 474 – Somnath Paul Aug 07 '14 at 04:05
  • And what is line 474? Try creating a really simple code example and see if that works. – Erlesand Aug 07 '14 at 08:47
  • I researched and found out that it was caused due to Password protected/ secured PDF file (I missed it earlier). The PDF > 1.4 version is getting merged smoothly now. However a new problem occured, when the file is password protected/ secured. Is there any method in php/codeigniter to check if the pdf is password protected ? – Somnath Paul Aug 07 '14 at 10:04
  • You can have a look at https://www.drupal.org/node/843516, however I recommend you to start a new question if you want further help with it :) – Erlesand Aug 07 '14 at 13:16
  • @SomnathPaul I'm having the same problem but the PDFs are not password protected. However, has come to my knowledge that the users were splitting the PDF's pages in 2 files(my process needs 2 files) and the software used is causing the issue – henrique May 10 '18 at 12:59
1

For symfony, I used this lib to convert pdf>1.4 to pdf1.4 :

https://packagist.org/packages/xthiago/pdf-version-converter

bouali atmane
  • 87
  • 1
  • 2
  • I'm the author of `xthiago/pdf-version-converter`. The library can be used in any PHP project - it no requires the use of Symfony Framework (Full Stack). The library internally uses two components of Symfony (process and filesystem), but composer takes care about it. I recommend you the use of the library because it has unit tests (PHPUnit) and is open-source - you can benefit of bug fixes and enhancements made by community. – xthiago Sep 24 '16 at 01:17