Using Adobe Acrobat, I added various annotations to a PDF. However, the Aspose library appears unable to read all of them, specifically those annotations created within Adobe Acrobat.
I have attached referral documents and a code snippet
then information about 8 annotations on the first page and six on the second will be displayed, which is the same as what Acrobat shows. 2.png (51.9 KB)
As you mentioned in the thread, if we remove the null condition check, the iteration will occur, but the object will have no content. How can I retrieve the content from the object?
@rajeev.francis
For some annotations in the attached document (like PopupAnnotation-s), Content is not specified.
Here is an excerpt from the pdf specification 3.png (65.2 KB)
The document “AnnotationSourceDocument.pdf” has two pages, The first page contains four annotations and the second has two, both are visible in browsers
On both pages, one annotation is created from Adobe Acrobat and the content is “Content from adobe” and “Adobe 2”.
My issue is that I can’t read the annotation created from Adobe Acrobat.
If you run the application you can see empty content from Adobe annotation but We can see the content in browsers and all other such applications.
Please attach a screenshot(s) for the document “AnnotationSourceDocument.pdf” opened in Acrobat, with marked on it ALL annotations that you believe are not found by the library.
@rajeev.francis
I am providing a slightly modified version of your code for iterating over document annotations.
My output is as follows WithLicense.png (6.8 KB) - please compare it with yours.
And also - what version of the library are you using?
Previously, demo versions had a limitation of displaying/processing four annotations per page max. In the latest version (24.5), the restrictions are less strict and I have the same output without a license.
var pdfDocument = new Document(dataDir + "AnnotationSourceDocument.pdf");
int index = 1;
foreach (var page in pdfDocument.Pages)
{
Console.WriteLine("Page: " + index++);
foreach (var annotation in page.Annotations)
if (annotation != null)
{
string info = "Ann. Type:" + annotation.AnnotationType.ToString() + "\t Contents: ";
if (!string.IsNullOrWhiteSpace(annotation.Contents))
info += annotation.Contents;
else
info += "None";
info += ("\t Rect: " + annotation.Rect);
Console.WriteLine(info);
}
}