cae*_*cae 2 html java pdf itext
我有这个代码,转换工作正常.但是我无法将页面大小设置为A3.
public static void main(String[] args) throws Exception {
File inputFile = new File("print_1.html");
OutputStream os = new FileOutputStream(new File(
"xhtmlToPdf_holaMundo.pdf"));
ITextRenderer renderer = new ITextRenderer();
renderer.layout();
Document document = new Document();
renderer.createPDF(os);
os.close();
}
Run Code Online (Sandbox Code Playgroud)
在css中:@page { size: 8.5in 11in; }
或者你可以setPageSize()
在文档对象上使用方法.
http://flyingsaucerproject.github.com/flyingsaucer/r8/guide/users-guide-R8.html#xil_34