Overlapping of characters when converting from HTML to PDF

I’m trying to convert HTML page to PDF using Aspose pdf version 16.10.0. But after the conversion, some characters are overlapping with each other.

//use temp dir for any images;
HtmlLoadOptions htmlOptions = new HtmlLoadOptions(tempDir.getRootDirectory().getAbsolutePath());

//render at LETTER instead of A4
htmlOptions.getPageInfo().setWidth(PageSize.getPageLetter().getWidth());
htmlOptions.getPageInfo().setHeight(PageSize.getPageLetter().getHeight());

Document pdf = new Document(source, htmlOptions);
pdf.save(target);

where source is InputStream and target is OutputStream objects.

Following are the screenshots attached from html and pdf files respectively.
html.png (8.7 KB)
pdf.png (52.3 KB)

@rupeshsai

Would you kindly share the sample HTML file with us so that we can test the scenario in our environment and address it accordingly.

Sure. This includes both html file and the output pdf file after conversion.
Archive.zip (41.7 KB)

@rupeshsai

We have used following code snippet along with Aspose.PDF for Java 20.1 and were unable to notice the issue. Would you kindly check the attached output and in case you notice any problem, please let us know.

HtmlLoadOptions options = new HtmlLoadOptions();
options.getPageInfo().setWidth(PageSize.getPageLetter().getWidth());
options.getPageInfo().setHeight(PageSize.getPageLetter().getHeight());
options.getPageInfo().setMargin(new MarginInfo(0,0,0,0));
Document doc = new Document(dataDir + "cover.html", options);
doc.save(dataDir + "HTMLtoPDF_20.1.pdf");

HTMLtoPDF_20.1.pdf (193.0 KB)

Thanks for helping.
From your reply, i can understand that you used a higher version of aspose PDF which is 20.1, but I’m using aspose PDF version 16.10.0. So can i conclude that the problem with the version of aspose PDF that I’m using for conversion or the code. Because I used all possible options required to convert html to PDF. Let me know where actually it was going wrong so that I can take necessary action to solve it.

@rupeshsai

Please note that support is provided on the basis of latest version available. That is why we request you to upgrade your API as latest version contains more fixes to the issues. Furthermore, you may also try specifying margins as following and see if it resolves the issue:

options.getPageInfo().setMargin(new MarginInfo(0,0,0,0));