Java:将ms word转换为pdf时标题空间中不需要的空格

Java:将ms word转换为pdf时标题空间中不需要的空格,java,pdf,apache-poi,xwpf,Java,Pdf,Apache Poi,Xwpf,我正在使用下面的代码将现有的word转换为PDF。 但在创建页面时,生成的PDF的第二页包含不需要的页眉空间。 是否可以从第二页删除此空间?在输入文件中,我在第一页有一个较大的头,在第二页只有一个较小的头 public static void main(String[] args) throws Exception { String inputFile = "input word.docx"; String outputFile = "output.pdf"; if

我正在使用下面的代码将现有的word转换为PDF。 但在创建页面时,生成的PDF的第二页包含不需要的页眉空间。 是否可以从第二页删除此空间?在输入文件中,我在第一页有一个较大的头,在第二页只有一个较小的头

  public static void main(String[] args) throws Exception {
    String inputFile = "input word.docx";
    String outputFile = "output.pdf";
    if ((args != null) && (args.length == 2)) {
        inputFile = args[0];
        outputFile = args[1];
    }

    FileInputStream in = new FileInputStream(inputFile);
    XWPFDocument document = new XWPFDocument(in);

    File outFile = new File(outputFile);
    OutputStream out = new FileOutputStream(outFile);
    PdfOptions options = null;
    PdfConverter.getInstance().convert(document, out, options);

}
添加的依赖项:

   <dependency>
    <groupId>com.lowagie</groupId>
    <artifactId>itext</artifactId>
    <version>2.1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.17</version>
</dependency>
<!-- https://mvnrepository.com/artifact/fr.opensagres.xdocreport/org.apache.poi.xwpf.converter.pdf -->
<dependency>
    <groupId>fr.opensagres.xdocreport</groupId>
    <artifactId>org.apache.poi.xwpf.converter.pdf</artifactId>
    <version>1.0.6</version>
</dependency>

com.lowagie

这是我当前生成的pdf输出,看起来像

maven依赖项的版本在哪里定义?版本是什么?@Boris谢谢你指出这一点。我现在已经用版本修改了依赖项。