我正在使用 HTMLConverter 将 html 转换为 PDF 并尝试设置一些边距。
现有代码:
ConverterProperties props = new ConverterProperties();
props.setBaseUri("src/main/resources/xslt");
PdfDocument pdf = new PdfDocument(new PdfWriter(new FileOutputStream(dest)));
pdf.setDefaultPageSize(new PageSize(612F, 792F));
HtmlConverter.convertToPdf( html, pdf, props);
Run Code Online (Sandbox Code Playgroud)
有人可以建议如何增加利润吗?我使用 Document 类来 setMargin 但不确定它如何进入 HTMLConverter 的 ConvertToPdf 方法。