word转PDF的时候怎么能合并页1和页2直接的空白呢?
LoadOptions loadOptions = new LoadOptions();
Document doc = new Document(inFileName, loadOptions);
for (Section section : doc.getSections())
{
// There are three kinds of footer and header types.
// 1 - The "First" header/footer, which only appears on the first page of a section.
HeaderFooter footer = section.getHeadersFooters().getByHeaderFooterType(HeaderFooterType.FOOTER_FIRST);
if (footer != null)
{
footer.remove();
}
// 2 - The "Primary" header/footer, which appears on odd pages.
footer = section.getHeadersFooters().getByHeaderFooterType(HeaderFooterType.FOOTER_PRIMARY);
if (footer != null)
{
footer.remove();
}
// 3 - The "Even" header/footer, which appears on even pages.
footer = section.getHeadersFooters().getByHeaderFooterType(HeaderFooterType.FOOTER_EVEN);
if (footer != null)
{
footer.remove();
}
}
PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
pdfSaveOptions.setHeaderFooterBookmarksExportMode(HeaderFooterBookmarksExportMode.NONE);
// 全面支持DOC, DOCX, OOXML, RTF HTML, OpenDocument, PDF,
doc.save(fileOS, pdfSaveOptions);
就是在word里第一个页面和第二个页面中间都有一个空白,怎么能在导出PDF的时候去掉这个空白呢?谢谢!
for (Section section : doc.getSections())
{
// There are three kinds of footer and header types.
// 1 - The "First" header/footer, which only appears on the first page of a section.
HeaderFooter footer = section.getHeadersFooters().getByHeaderFooterType(HeaderFooterType.FOOTER_FIRST);
if (footer != null)
{
footer.remove();
}
// 2 - The "Primary" header/footer, which appears on odd pages.
footer = section.getHeadersFooters().getByHeaderFooterType(HeaderFooterType.FOOTER_PRIMARY);
if (footer != null)
{
footer.remove();
}
// 3 - The "Even" header/footer, which appears on even pages.
footer = section.getHeadersFooters().getByHeaderFooterType(HeaderFooterType.FOOTER_EVEN);
if (footer != null)
{
footer.remove();
}
}
页眉、页脚我页去掉了,但是在导出的PDF里还是有页眉、页脚
好吧,谢谢!共同进步!
1 Like
再问一下,转为图片时候能去掉分页符吗,或者是转为其它格式能去掉分页符。谢谢