We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Insert HTML string in existing PDF using Aspose.PDF for Java - code is taking time

Hi Team

I am using jdk 8 with aspose pdf version 19.5. I want to insert html code into existing pdf.
Below is my sample code.

Document pdfDocument = new com.aspose.pdf.Document(“pdf file path here”);
Page pdfPage = pdfDocument.getPages().get_Item(1);
HtmlFragment htmlFragment = new HtmlFragment(“html italic tag start Deepak Gupta html italic tag end”);
FloatingBox box1 = new FloatingBox();
pdfDocument.save(“path to save updated pdf”);

Above code is taking two much to update the existing pdf.
and when I try to do the same with textfragment class . Then it is working fine

TextFragment textFragment = new TextFragment(“Deepak Gupta”);
textFragment.setPosition(new Position((double)100, 100));
TextBuilder textBuilder = new TextBuilder(pdfPage);

I am also attaching pdf file that I am using on my system. Please help me why it is taking time ?

blank_1599119324527_1599119340334.pdf (939 Bytes)


We have tested the scenario in our environment using Aspose.PDF for Java 20.8 and API generated output within 1 second. Would you please try using latest version of the API and in case you still face any issue, please feel free to let us know.

Right now we cannot update the version, Can you please try with version 19.5 also.


The support is provided on the basis of latest version of the API and if an issue is not occurring in latest version, we cannot log any ticket against it. Furthermore, issues logged for older versions are resolved in higher/latest versions of the API which is why we always recommend to use latest version. In case you have further inquiry, please feel free to ask.