我有这段代码,转换工作正常。但是我不能将页面大小设置为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();
}发布于 2011-12-17 21:09:15
在css:@page { size: 8.5in 11in; }中,您可以对document对象使用setPageSize()方法。
http://flyingsaucerproject.github.com/flyingsaucer/r8/guide/users-guide-R8.html#xil_34
https://stackoverflow.com/questions/8535518
复制相似问题