Free Support Forum - aspose.com

Output html messed up

Hi,


I’m using Aspose Pdf for Java 4.5.0 to convert pdf files to htmls. In some senarios, the output html is messed up. Please get the sample files attached.

Code:
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(rootPath + fileName);
com.aspose.pdf.HtmlSaveOptions pdfHso = new com.aspose.pdf.HtmlSaveOptions();
pdfHso.setFixedLayout(true);
pdfDocument.save(rootPath + fileName + “.html”, pdfHso);

Hi Vincent,


Thanks for your inquiry. While testing the scenario with Aspose.Pdf for Java 4.5.0, we have manged to notice the formatting issues in resultant HTML document and logged as following in our issue tracking system.

PDFNEWJAVA-33940: Header text rendered incorrectly
PDFNEWJAVA-33941: Extra space with commas in text
PDFNEWJAVA-33942: Text formatting issue in footer

Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFJAVA-33940,PDFJAVA-33942) have been fixed in Aspose.PDF for Java 18.4. This message was posted using BugNotificationTool from Downloads module by asad.ali

@vincentLi

Thanks for your patience.

The issue you have found earlier (filed as PDFJAVA-33941) has been fixed in Aspose.PDF for Java 18.5. As we did not have all required Chinese fonts, the code snippet below (with fonts substitution) has been used:

com.aspose.pdf.Document doc = new com.aspose.pdf.Document(myDir+"21389169205200.pdf");
FontRepository.getSubstitutions().add(new CustomSubst1());
com.aspose.pdf.HtmlSaveOptions htmlsave = new com.aspose.pdf.HtmlSaveOptions();
htmlsave.setFixedLayout(true);
doc.save(myDir+"Test.Html", htmlsave);

...

private static class CustomSubst1 extends CustomFontSubstitutionBase {
 public boolean trySubstitute(OriginalFontSpecification originalFontSpecification,  com.aspose.pdf.Font[] substitutionFont) {
    substitutionFont[0] = FontRepository.findFont("Arial Unicode MS"); // or some other font with Chinese characters
    return true;
 }
}

Please, pay attention, that comma symbols in the substitution font little differ from the symbols in the origin font and if it does not fit, please, try to use another font.