We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge Annotations via a stream

I have been merging annotations from one document to copies of that document by going through the process of writing them from sharepoint, to the file system, and back to sharepoint. I just tried changing the code to bypass the file system and write/read/write directly to streams. I am getting the following error on the import:


Expected > for tag: < near line 4, column 4.

Here is the code:

Stream mergeSource = new MemoryStream(userBin);

Stream[] annotStream = new MemoryStream[1];

annotStream[0] = mergeSource;

Stream inputPdf = new MemoryStream(masterBin);

PdfAnnotationEditor pdfAnnEditor = new PdfAnnotationEditor();


Enum[] annotType ={ AnnotationType.Polygon, AnnotationType.Caret, AnnotationType.Circle, AnnotationType.FreeText, AnnotationType.FileAttachment, AnnotationType.HightLight, AnnotationType.Ink, AnnotationType.Line, AnnotationType.Link, AnnotationType.Movie, AnnotationType.PolyLine, AnnotationType.Popup, AnnotationType.PrinterMark, AnnotationType.Screen, AnnotationType.Sound, AnnotationType.Square, AnnotationType.Squiggly, AnnotationType.Stamp, AnnotationType.StrikeOut, AnnotationType.Text, AnnotationType.TrapNet, AnnotationType.UnderLine, AnnotationType.Watermark, AnnotationType.Widget };



I noticed that the method ImportAnnotationFromXfdf() is used in the above code; that method should take a xml file (end with .Xfdf) as input. Mabe you want to use the method PdfAnnotationEditor.ImportAnnotations() .


That's where I had started, but pdfAnnEditor.ImportAnnotations(inputStream, annotationEnumeration) does not seem to be recognizing the stream.

Intellisense recognizes it, and it compiles, but when it executes it throws an exception that says: "Argument '1': cannot convert from System.IO.Stream to string[].

Any ideas?

By the way, the new build fixes some annotation import errors.


please post the complete code that you used, I will check it and give some advice.