Hello Team,
I found an issue during merged annotation function using this code:
List pdfFiles = new List();
//add files to list
Document one = new Document(“008400002425-008338ENV.pdf”);
pdfFiles.Add(one);
Document two = new Document(“008400002425-008339ENV.pdf”);
pdfFiles.Add(two);
Document three = new Document(“008400002425-008342ENV.pdf”);
pdfFiles.Add(three);
Document four = new Document(“008400002425-008343ENV.pdf”);
pdfFiles.Add(four);
Document five = new Document(“008400002425-008344ENV.pdf”);
pdfFiles.Add(five);
Document six = new Document(“008400002425-008345ENV.pdf”);
pdfFiles.Add(six);
Document seven = new Document(“008400002425-008346ENV.pdf”);
pdfFiles.Add(seven);
Document eight = new Document(“008400002425-008645ENV.pdf”);
pdfFiles.Add(eight);
Document nine = new Document(“008400002425-008856ENV.pdf”);
pdfFiles.Add(nine);
// Merging comments
Boolean isFirst = true;
Document result = new Document();
PdfAnnotationEditor finalEdit = null;
foreach (Document d in pdfFiles)
{
if (isFirst)
{
result = d;
isFirst = false;
finalEdit = new PdfAnnotationEditor();
finalEdit.BindPdf(result);
}
else
{
//Extract annotations from current pdf d
PdfAnnotationEditor currentEdit = new PdfAnnotationEditor();
currentEdit.BindPdf(d);
MemoryStream annotstream = new MemoryStream();
Enum[] annotType = {
Aspose.Pdf.Annotations.AnnotationType.Caret,
Aspose.Pdf.Annotations.AnnotationType.Circle,
Aspose.Pdf.Annotations.AnnotationType.FileAttachment,
Aspose.Pdf.Annotations.AnnotationType.FreeText,
Aspose.Pdf.Annotations.AnnotationType.Highlight,
Aspose.Pdf.Annotations.AnnotationType.Ink,
Aspose.Pdf.Annotations.AnnotationType.Line,
Aspose.Pdf.Annotations.AnnotationType.Link,
Aspose.Pdf.Annotations.AnnotationType.Movie,
Aspose.Pdf.Annotations.AnnotationType.Polygon,
Aspose.Pdf.Annotations.AnnotationType.PolyLine,
Aspose.Pdf.Annotations.AnnotationType.Popup,
Aspose.Pdf.Annotations.AnnotationType.PrinterMark,
Aspose.Pdf.Annotations.AnnotationType.Redaction,
Aspose.Pdf.Annotations.AnnotationType.Screen,
Aspose.Pdf.Annotations.AnnotationType.Sound,
Aspose.Pdf.Annotations.AnnotationType.Square,
Aspose.Pdf.Annotations.AnnotationType.Squiggly,
Aspose.Pdf.Annotations.AnnotationType.Stamp,
Aspose.Pdf.Annotations.AnnotationType.StrikeOut,
Aspose.Pdf.Annotations.AnnotationType.Text,
Aspose.Pdf.Annotations.AnnotationType.TrapNet,
Aspose.Pdf.Annotations.AnnotationType.Underline,
Aspose.Pdf.Annotations.AnnotationType.Unknown,
Aspose.Pdf.Annotations.AnnotationType.Watermark,
Aspose.Pdf.Annotations.AnnotationType.Widget
};
currentEdit.ExportAnnotationsXfdf(annotstream, 1, d.Pages.Count, annotType);
annotstream.Position = 0;
// Import annotations in result file
finalEdit.ImportAnnotationFromXfdf(annotstream, annotType);
}
}
Save(result);
When importing annotation from xfdf format with the ‘finalEdit.ImportAnnotationFromXfdf(annotstream, annotType);’ function for the eighth pdf document the error below is raised :
System.ApplicationException: Unknown XFDF element ‘freetext’
at Aspose.Pdf.Annotations.XfdfReader.GetElements(XmlReader reader)
at Aspose.Pdf.Annotations.TextMarkupAnnotation.hulrgtdcn4a36jvghassc3d9p8uvbscd? (XmlReader )
at Aspose.Pdf.Annotations.XfdfReader.ReadAnnotations(Stream stream, Document document)
at Aspose.Pdf.Facades.PdfAnnotationEditor.ImportAnnotationFromXfdf(Stream xfdfStream, Enum[] annotType)
at CsctConverter.AsposeConverters.PdfConverter.MergeAllAnnotations(MemoryStream zipFile)
at CsctConverter.RFCInterfaces.RFCPdfAnnotMerger.CallAsposeTransfo(IRfcFunction function)
at CsctConverter.RFCInterfaces.AbstractRfcConverter.RunTransfo(IRfcFunction function, RfcServerContext serverContext, MethodBase aMethod)
Could you investigate on it please ?
Many thanks
Regards008400002425-008339ENV.pdf (459.4 KB)
008400002425-008338ENV.pdf (483.5 KB)
008400002425-008342ENV.pdf (476.4 KB)
008400002425-008342ENV.pdf (476.4 KB)
008400002425-008342ENV.pdf (476.4 KB)
008400002425-008342ENV.pdf (476.4 KB)
008400002425-008342ENV.pdf (476.4 KB)
008400002425-008342ENV.pdf (476.4 KB)
008400002425-008645ENV.pdf (509.8 KB)