Free Support Forum - aspose.com

java.io.IOException: java.io.IOException: PDF header signature error

I am evaluating the PDF kit for stamping PDF files with other PDF files.
Implementation language is Jython (implementation of Python in Java).

The following code causes:

from com.aspose.pdf.kit import PdfFileStamp, Stamp

stamp = PdfFileStamp('1.pdf', 'out.pdf')

pdf = Stamp()
pdf.bindPdf("anzeige.pdf", 1)
pdf.setImageSize(200,200)
pdf.setOrigin(100,100)
pdf.isBackground(False)

stamp.addStamp(pdf);
stamp.close()

causes this error

Traceback (most recent call last):
File "x.py", line 15, in
stamp.close()
at com.aspose.pdf.kit.kz.k(Unknown Source)
at com.aspose.pdf.kit.oj.a(Unknown Source)
at com.aspose.pdf.kit.oj.(Unknown Source)
at com.aspose.pdf.kit.oj.(Unknown Source)
at com.aspose.pdf.kit.PdfFileStamp.b(Unknown Source)
at com.aspose.pdf.kit.PdfFileStamp.a(Unknown Source)
at com.aspose.pdf.kit.PdfFileStamp.b(Unknown Source)
at com.aspose.pdf.kit.PdfFileStamp.close(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

java.io.IOException: java.io.IOException: PDF header signature error.

Both input PDF files are valid PDF files (open with Preview and Acroread on Lion without issues).

What's the problem here?

Hi Andreas,

Please share the input PDF file with us along with the details of your development environment.
We’ll investigate this issue at our end and guide you accordingly.

We’re sorry for the inconvenience.
Regards,

Files attached

The problem seems to be related to multi-page PDF input files.


Using a single-page PDF as input does not cause any problem.

Hi Andreas,

Thank you very much for sharing the sample PDF files. I’m sorry to share with you that in the initial investigation, we have noticed some problem while processing these files under JDK 1.6. However, we still need to investigate the issue in detail with Jython or Python for that matter. Please spare us some time, so we could look into this issue. You’ll be updated via this forum thread as soon as the investigation is complete.

We’re sorry for the inconvenience.
Regards,

Hi Andreas,

I have reproduced this issue at my end and logged it as PDFKITJAVA-32320 in our issue tracking system. Our team will look into this issue and you’ll be updated via this forum thread once it is resolved.

We’re sorry for the inconvenience.
Regards,

Is there any update on this?

Is issue PDFKITJAVA-32320 still unresolved? or is there maybe a workaround?


Thank you!

Hi,


Thanks for contacting support.

Recently we have ported Aspose.Pdf for .NET code to Java platform and during my testing with the autoported release version, I am unable to notice any problem while adding one PDF file as stamp object to other PDF document. Please note that during my initial testing, I have used a simple Java application developed in Eclipse running over Windows 7 (X64). Can you please try using the first autoported release of Aspose.Pdf for Java 4.0.0 and in case you still face the same problem, please feel free to contact.

For your reference, I have also attached the resultant stamped PDF document.