[iTextSharp] MergePDF_Bulk not working for a few pdfs

[iTextSharp] MergePDF_Bulk not working for a few pdfs

  
Forge Component
(12)
Published on 2015-09-10 by Luis Filipe Oliveira
12 votes
Published on 2015-09-10 by Luis Filipe Oliveira

Hi guys...

MergePDF_Bulk is not working for a few PDFs, I tried to compare PDFs that works with the not working ones ... And I see no diference. When I try to merge the error( "The document has no pages. ")  is showed up. If you guys need the PDFs for example, I can provide it. Thank you all!

Solution

I came across the same problem a while ago. This was due to some PDFs being password protected.

The only way around it was to add 

PdfReader.unethicalreading = true;

after you instantiate the PdfReader inside the extension. See more info here - https://stackoverflow.com/questions/451070/can-i-fill-in-an-encrypted-pdf-with-itextsharp

Unfortunately, this feature only appeared on paid versions of iTextSharp...


Miguel

Solution

Hello, I'm having this error, but I'm sure PDFs do not have a password because I'm the one who is generating them. Is there any other possible reason? To edit this property will I have to change the extension?

I solved this, like Miguel said you need set:


PdfReader.unethicalreading = true;


But before you need update the version of itextSharp library, because the version included in the component don't have this configuration.