ASPOSE PDF Java版 - > 11.8
我正在尝试使用HeaderFooter类将标题添加到PDF文件的每个页面。以下是代码,
- 此变量流包含HTML的流式内容。
htmlOptions - 用于设置生成文件的边距。
Document pdfDocument = new Document( is, htmloptions );
Iterator<Page> pages = pdfDocument.getPages().iterator();
while( pages.hasNext() ){
Page pageCollection = pages.next();
HeaderFooter header = new HeaderFooter();
Paragraphs headParagraph = new Paragraphs();
HtmlFragment headfragment = new HtmlFragment( pdfHeaderContent );
headfragment.setVerticalAlignment( VerticalAlignment.Top );
MarginInfo marginInfo = new MarginInfo();
marginInfo.setLeft( 10d );
marginInfo.setRight( 10d );
marginInfo.setBottom( 10d );
marginInfo.setTop( 10d );
header.setMargin( marginInfo );
headParagraph.add( headfragment );
header.setParagraphs( headParagraph );
pageCollection.setHeader( header );
}
请告诉我如何设置标题的高度?