JavaPDFBox将html标记(如<td>)内的数据拆分为单独的页面。如何指定拆分页面的位置?
我正在使用pdfbox将一个HTML文件转换为pdf,当它生成页面时,它会将底部HTML标记(如)内的数据分成两个页面。 我如何指定某种类型的部分(或组)来分隔数据。 这样它就不会在标签中分割数据,比如
public byte[] createPDF(String htmlData) {
try {
byte[] pdfCon = super.createPDF(htmlData);
pdfCon = drawVerticalLine(pdfCon);
return pdfCon;
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
}
protected byte[] drawVerticalLine(byte[] content )
throws Exception {
PDDocument doc = PDDocument.load(content);
int pageCount = doc.getNumberOfPages();
PDPageContentStream canvas;
...
}
# 1 楼答案
这对我有用