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

Free Support Forum - aspose.com

Convert HTML to PDF with table in landscape

Aspose.Words for Java v17.7

When I convert HTML to PDF with a table in landscape mode, the table doesn’t fit the page. It stays as portrait page.

Please see attached the test code and files to reproduce the issue. How to fix that?

HTMLToPDFLandscape.zip (72.9 KB)


Thanks for your inquiry. Please use updateTableLayout method to adjust width of table and cells as following. It will resolve the issue.
test_AW177.pdf (74.2 KB)

Document dstDoc = new Document("test.html");
DocumentBuilder builder = new DocumentBuilder(dstDoc);
dstDoc.save("test_AW177.pdf", SaveFormat.PDF);


That’s right. It worked perfectly.