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

Hi,

As per client requirement, I want to try converting the ‘.TXT’ file to ‘.PDF’ file and find the page numbers of the PDF file using the below jars:

  1. Aspose.Words.jdk15.jar
  2. aspose-pdf-2.7.0-jdk15.jar
  3. aspose-pdf-kit-3.7.0.jar

I have converted successfully from txt file to PDF file but when I am trying to find the page number of the PDF file, I am getting the “PDF header signature error”.

Please find the attached java code and could you please check the problem based on the above jars?

It is urgently needed. Can you please check or can you share the java code if it is possible?

Regards,
RSY Narayan

Hi Subramanum,


Thanks for your inquiry. Your query is related to Aspose.Pdf. I am moving this thread to Aspose.Pdf forum. My colleagues from Aspose.Pdf team will reply you shortly.

Hi Subramanum,


Thanks for your inquiry. I’m afraid I’m unable to test your code as there are some missing references, mentioned below. Can you please confirm the Aspose.Words for Java version that you are using in your application.

import com.itextpdf.text.Chunk;
import com.itextpdf.text.Document;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;

Best Regards,

Hi ,

Thanks for the reply.

I found the solution and it is working fine as per the requirement. So you can close the issue.

Regards,

RSY Narayan

Hi Narayan,


I am glad to hear that your problem seems to be fixed. As per my understanding, the PDF document generated in previous step was not valid. Anyways, please continue using our product and in the event of any further query, please feel free to contact.