Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Import XFDF to PDF

$
0
0
I try to import XFDF to PDF and create an annotated PDF version. Following is my sample program. The program can be run, but the output.pdf does not include any annotations. Any suggestions to solve this problem? 

final String ROOT  = "C:\\PdfAnnotation\\";
final String sourcePDF = "sample.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
editor.importAnnotationFromXfdf(fileStream);
//save output pdf file
editor.save(ROOT + destPDF);

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

Viewing all articles
Browse latest Browse all 3131

Trending Articles