Hi,
I’m converting a HTML to a PDF and want to use landscape pages.
final ByteArrayInputStream bais = new ByteArrayInputStream(...)
final HtmlLoadOptions loadOptions = new HtmlLoadOptions();
loadOptions.setHtmlMediaType(HtmlMediaType.Print);
loadOptions.setEmbedFonts(true);
loadOptions.setPageLayoutOption(HtmlPageLayoutOption.FitToWidestContentWidth);
PageInfo pageInfo = new PageInfo();
pageInfo.setLandscape(true);
// Margin
MarginInfo marginInfo = new MarginInfo();
marginInfo.setTop(50);
marginInfo.setRight(50);
marginInfo.setBottom(50);
marginInfo.setLeft(50);
pageInfo.setMargin(marginInfo);
loadOptions.setPageInfo(pageInfo);
final com.aspose.pdf.Document htmlDocument = new com.aspose.pdf.Document(bais, loadOptions);
ByteArrayOutputStream transformedPdf = new ByteArrayOutputStream();
htmlDocument.save(transformedPdf);
transformedPdf.close();
... save result to disk ...
The resulting PDF does not contain landscape pages.
The margin config is taken into account, so I believe I’m configuring it correctly.
Can anyone point me in the right direction? Am I doing it ‘wrong’ or did I find a bug?
Tested with version 22.12 as 23.1 is not released yet for Java at the time of writing.
Thanks