Adding two extra page while converting Dynamic pdf to standard pdf form type

Hi Aspose Java Support Team,
Please help me to resole the issue that i am facing an issue adding two extra blank while converting dynamics pdf form type to standard. as i am using license version of aspose for pdf (version aspose.pdf-11.6.0.jar) and license file is Aspose.Total.Java.lic

Please find the below code which i am using and the pdf attachment file which i am using for this.

String fileHome = System.getProperty( “user.home” ) + “\Desktop\PdfTest\”;

LicenseUtil.getInstance();

com.aspose.pdf.Document pdfDocument1 = new com.aspose.pdf.Document(fileHome + “someDoc1.pdf”);

System.out.println( “pdfDocument1 … size before set form…number of pages…” + pdfDocument1.getPages().size());
System.out.println( “Before hasxfa …” + pdfDocument1.getForm().hasXfa());

pdfDocument1.getForm().setType(com.aspose.pdf.FormType.Standard);

System.out.println( “pdfDocument1 … After set form…number of pages…” + pdfDocument1.getPages().size());
System.out.println( “After …” + pdfDocument1.getForm().hasXfa());

com.aspose.pdf.Document pdfDocument2 = new com.aspose.pdf.Document(fileHome + “someDoc2.pdf”);

System.out.println( “pdfDocument1 … before set form…number of pages…” + pdfDocument2.getPages().size());
System.out.println( “Before hasxfa …” + pdfDocument1.getForm().hasXfa());

pdfDocument2.getForm().setType(com.aspose.pdf.FormType.Standard);

System.out.println( “pdfDocument1 … After set form…number of pages…” + pdfDocument2.getPages().size());
System.out.println( “After …” + pdfDocument1.getForm().hasXfa());

for(int x=1; x <=pdfDocument1.getPages().size(); x++){

Page page=pdfDocument1.getPages().get_Item(x);

pdfDocument2.getPages().add(page);
}

pdfDocument2.save(fileHome + “Merged.pdf”);
pdfDocument2.dispose();



Please help me to fix this issue.

Thanks and Regards
Dinbandhu K.G

Hi Dinbandhu,


Thanks for your inquiry. It seems your shared document “someDoc1.pdf” is corrupt, we will appreciate it if you please share it again, so we will test the scenario and will provide you information accordingly.

We are sorry for the inconvenience.

Best Regards,

Hi Tilal ahmad
Please find the attachment files which i received originally but rename to someDoc1.pdf ans someDoc2.pdf


Thanks & Regards
Dinbandhu k.G

Hi Dinbandhu,

Thanks for sharing again the resource documents. I have tested your scenario with shared documents using Aspose.Pdf for Java 11.8.0 and managed to observe the extra pages. For further investigation, I have logged an issue in our issue tracking system as PDFJAVA-36111 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.

Hi Tilal,
Thanks for your update.
please let me know if you guys found any solution for it.

Thanks & Regards
Dinbandhu K.G

Hi Dinbandhu,


Thanks for your feedback. Sure, we will notify you as soon as we made some significant progress towards issue resolution.

Best Regards,

@Dinbandhu

Thanks for your patience.

We are pleased to inform you that earlier logged issue PDFJAVA-36111 has been resolved in Aspose.PDF for Java 18.1. Please download latest version of the API and in case of any issue, feel free to contact us.