Pages

Thursday, February 6, 2014

itext pdf header signature not found

itext pdf header signature not found

I am trying to split a PDF into multiple PDF. (ex)Each page to a separate PDF.

While searching, I got these links , regarding splitting PDF into multiple PDF files.

http://www.rgagnon.com/javadetails/java-0647.html
http://www.simplecodestuffs.com/splitting-pdf-file-using-java-itext-api/

I tried to split a PDF into 2 PDF files.
Say I have 'N' no. of pages in a PDF.

Let M=N/2

Now Pages from 1 to M will be stored in one PDF file
Pages from M+1 to N will be stored in second PDF file.

When I run the code, I got this error.

PDF header signature not found.

After going through forums, at last I got a solution at this link.

http://stackoverflow.com/questions/17866468/error-on-editing-existing-pdf-document-pdf-header-signature-not-found


Earlier my code contained,

                        PdfReader inputPDF = new PdfReader(InputStream);
Where InputStream is of FileInputStream class Instance.

I replaced the reader part with,
                        PdfReader inputPDF = new PdfReader(FileName);

Where FileName is of String Class

Atlast, this solved my issue.

2 comments:

  1. Hi,
    I am trying to split a PDF into multiple PDF. (ex)Each page to a separate PDF.
    PDF signature

    ReplyDelete
  2. Hello Aeldra Robinson,

    Did you tried this ?

    http://www.rgagnon.com/javadetails/java-0647.html
    http://stackoverflow.com/questions/17099870/separating-pdf-pages-in-java

    Need to be careful with Version of Jar file(s).

    -
    Krishnan

    ReplyDelete