PDF文件的页眉和页脚,Aspose Java

时间:2017-09-04 15:40:41

标签: java html pdf aspose aspose.pdf

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 );

            }

请告诉我如何设置标题的高度?

0 个答案:

没有答案