【问题标题】:Multiple XSL to single PDF多个 XSL 到单个 PDF
【发布时间】:2011-10-03 15:58:24
【问题描述】:

我们有 5 个 xsl 文件,用于转换的 xml 内容在运行时生成,当我们为单个 xsl 文件生成单个 pdf 时,它工作正常。

我们的要求是我们需要根据运行时输入为 5 个 xsl 文件生成一个 pdf。

ex:输入是 3 个 xsl 文件名,那么我们需要生成一个包含多个页面中的 3 个 xsl 内容的单个 pdf。

我们正在使用 Apache FOP 1.0 和 Java 1.5。

提前致谢

谢谢 -阿鲁尔

【问题讨论】:

    标签: xsl-fo apache-fop


    【解决方案1】:

    由于您已经能够将 XSL 转换为 PDF,您可以尝试使用 Aspose.Pdf.Kit for Java 将由这些 XSL 文件创建的 concatenate multiple PDF files 转换为单个 PDF。 代码很简单:

    //read the input file
    String inFile1 = "example1.pdf";
    String inFile2 = "example2.pdf";
    String outFile = "kitOut1.pdf";
    
    FileInputStream inStream1 = new FileInputStream(inFile1);
    FileInputStream inStream2 = new FileInputStream(inFile2);
    
    
    //concatenate two files
    FileOutputStream outputStream = new FileOutputStream(outFile);
    PdfFileEditor editor = new PdfFileEditor();
    editor.concatenate(inStream1, inStream2, outputStream);
    
    //close the output FileOutputStream
    outputStream.close();
    

    披露:我在 Aspose 担任开发布道师。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-19
      • 2022-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-21
      相关资源
      最近更新 更多