Tried to convert the HTML file included here: test_aspose.zip (1.5 KB) using the following Java code:
public StreamingResponseBody asposePdf(@RequestParam(name="html") final String htmlInput) throws Exception {
final var license = new com.aspose.html.License();
license.setLicense(TestController.class.getResourceAsStream("/Aspose.HTML.Java.lic"));
final var pdfSaveOptions = new com.aspose.html.saving.PdfSaveOptions();
pdfSaveOptions.setJpegQuality(100);
pdfSaveOptions.getCss().setMediaType(com.aspose.pdf.internal.html.rendering.MediaType.Screen);
final var document = new com.aspose.html.HTMLDocument(htmlInput, ".");
try {
final var out = new ByteArrayOutputStream();
final var device = new com.aspose.html.rendering.pdf.PdfDevice(pdfSaveOptions, out);
document.renderTo(device);
return streamResponse(out.toByteArray());
} finally {
document.dispose();
}
}
and the result is different (wrong alignment and formatting, table does not render) compared to the same input begin used in: Aspose.HTML Applications.
Any idea why this happens ?
I am using a temporary license for Aspose.HTML with Aspose Java v 21.4 running on a Spring Boot 2.4.4 application.
For comparison
Online tool result: test_aspose.pdf (67.1 KB)
Java API result: response.pdf (80.1 KB)