1

我创建了一个示例程序来尝试使用 Aspose 库将 XFDF 导入 PDF。该程序可以毫无例外地运行,但输出的 PDF 不包含任何注释。有什么建议可以解决这个问题吗?

更新 - 2014-12-12

我也已将问题发送给 Aspose。他们可以重现相同的问题,并在他们的问题跟踪系统中记录一个票PDFNEWJAVA-34609 。

以下是我的示例程序:

public static void main(String[] args) {

    final String ROOT  = "C:\\PdfAnnotation\\";
    final String sourcePDF = "hackermonthly-issue.pdf";
    final String destPDF = "output.pdf";
    final String sourceXFDF = "XFDFTest.xfdf";

    try
    {
        // Specify the path of license file
        License lic = new License();
        lic.setLicense(ROOT + "Aspose.Pdf.lic");
        //create an object of PdfAnnotationEditor class
        PdfAnnotationEditor editor = new PdfAnnotationEditor();
        //bind input PDF file
        editor.bindPdf(ROOT + sourcePDF);
        //create a file stream for input XFDF file to import annotations
        FileInputStream fileStream = new FileInputStream(ROOT + sourceXFDF);
        //create an enumeration of all the annotation types which you want to import
        //int[] annType = {AnnotationType.Ink };
        //import annotations of specified type(s) from XFDF file
        //editor.importAnnotationFromXfdf(fileStream, annType);
        editor.importAnnotationFromXfdf(fileStream);
        //save output pdf file
        editor.save(ROOT + destPDF);

    } catch (Exception e) {
        System.out.println("exception: " + e.getMessage());
    }

}
4

0 回答 0