Whenever you get messages about missing packages (or suggestions to modify your PKG_CONFIG_PATH) during a build, it usually indicates that you are missing the corresponding development package - which is typically separate from the runtime package that is normally installed on the system.
In this case you have the most recent version of fontconfig but are probably missing the corresponding libfontconfig1-dev package.
Note that the full path to “/usr/sbin/wol” is important. Simply “wol” will not work.
Substitute AA:BB:CC:DD:EE:FF with the actual MAC address of the computer which you wish to boot remotely. Likewise, replace 192.168.1.255 with the actual broadcast address of the network (192.168.1.255 is the broadcast address when the machine has an IP of 192.168.1.x and subnet mask of 255.255.255.0). Replace “PP” with the port number your machine listens on (usually 7 or 9).
/** * * TODO 关闭文档时,替换模板,完成整个页眉页脚组件 * * @see com.itextpdf.text.pdf.PdfPageEventHelper#onCloseDocument(com.itextpdf.text.pdf.PdfWriter, * com.itextpdf.text.Document) */ publicvoidonCloseDocument(PdfWriter writer, Document document) { // 7.最后一步了,就是关闭文档的时候,将模板替换成实际的 Y 值,至此,page x of y 制作完毕,完美兼容各种文档size。 total.beginText(); total.setFontAndSize(bf, presentFontSize);// 生成的模版的字体、颜色 Stringfoot2=" " + (writer.getPageNumber() - 1) + " 页"; total.showText(foot2);// 模版显示的内容 total.endText(); total.closePath(); } }
页边距
Isn’t it possible for you to use HtmlConverter#convertToElements method. It returns List as a result and then you can add its elements to a document with set margins:
1 2 3 4 5 6 7
Documentdocument=newDocument(pdfDocument); Listlist= HtmlConverter.convertToElements(newFileInputStream(htmlSource)); for (IElement element : list) { if (element instanceof IBlockElement) { document.add((IBlockElement) element); } }
Another approach: in your html just introduce the @page rule which sets the margins you need, for example:
1
@page {margin: 0;}
Yet another solution: implement your own custom tag worker for tag and set margins on its level. For example, to set zero margins one could create tag the next worker:
and pass it as a ConverterProperties parameter to Htmlconverter:
converterProperties.setTagWorkerFactory(new CustomTagWorkerFactory()); HtmlConverter.convertToPdf(new File(htmlPath), new File(pdfPath), converterProperties);
表格跨页问题
代码的处理方式
pdfHtml的一种处理方式
I had a similar issue of trying to keep together content within a div. I applied the following css property and this kept everything together. This worked with itext7 pdfhtml.
Please read the official documentation for iText 7, more specifically Chapter 6: Reusing existing PDF documents In PDF, there’s the concept of _Form XObject_s. A Form XObject is a piece of PDF content that is stored outside the content stream of a page, hence XObject which stands for eXternal Object. The use of the word Form in Form XObject could be confusing, because people might be thinking of a form as in a fillable form with fields. To avoid that confusing, we introduced the term PdfTemplate in iText 5. The class PdfImportedPage you refer to was a subclass of PdfTemplate: it was a piece of PDF syntax that could be reused in another page. Over the years, we noticed that people also got confused by the word PdfTemplate. In iText 7, we returned to the basics. When talking about a Form XObject, we use the class PdfFormXObject. When talking about a page in a PDF file, we use the class PdfPage. This is how we get a PdfPage from an existing document: