Free Support Forum - groupdocs.com

Get annotation's content from pdf file


#1

Hello,

I already tried to get all annotations from a PDF file with GroupDoc Annotation. I managed to get a lot of informations in a xml file using the exemple on GitHub but I can’t get the content (text) of this annotations :
For the moment I have used these functions :
DataStorage.ExportAnnotationInFile();
DataStorage.CreateAndGetAnnotation();
DataStorage.GetAllDocumentAnnotation();
DataStorage.RemoveAnnotation();
CommonUtilities.GetConfiguration();
but it doesn’t work…

Can you please let me know if it is possible to do this thing using group docs annotation and how to do it ?


#2

@JeanClaudePatrick,

In order to investigate this issue, we need following details:

  • PDF file
  • API version (e.g. 19.3, 19.4) that you used

#3

Thanks for fast reply,

I am using the 19.3 version of API.
I am trying to get the text’s annotation of my PDF (which is supposed to be "hello"in the following screen) in my xml file but here are the informations I get with DataStorage.CreateAndGetAnnotation() :

Screen PDF.PNG (119.6 KB)

XML2.PNG (3.3 KB)
XML1.PNG (11.5 KB)
XML3.PNG (37.8 KB)

And here is the pdf file I used :

Annotated.pdf (587.7 KB)

What am I doing wrong ?


#4

@JeanClaudePatrick,

Did you commit any change in CreateAndGetAnnotation method? If yes, can you please share that? Because the document you shared has a text area annotation and with a comment/reply added it it. However, CreateAndGetAnnotation doesn’t have text area annotation code.
Did you add “Hello” by opening the output PDF or programatically?
We’ll appreciate if you share your complete use-case/process in steps.


#5

I didn’t change anything in the CreatAndGetAnnotation method. I just added the comment “Hello” by opening the output PDF and running the code (I also tried to add comments programatically and the result is the same).

My aim is to get every text of the comment entered manually or programatically with some information (where they are on the page, on which page, when they have been added, who added it) and to store them in a file whatever the type (xml, txt,… for example).

To give you an example, for the previous PDF file, I would like to get into a file :
“Hello” ; Coordinates, “Page 1”, “28/05/2019 17:24”, “Anonym A”


#6

@JeanClaudePatrick,

Please add following code in AnnotationInfo and then check out the generated xml file.

Replies = new AnnotationReplyInfo[]
{
    new AnnotationReplyInfo
    {
        Message = "Hello this is text field annotation!",
        RepliedOn = DateTime.Now,
        UserName = "John"
    },
    new AnnotationReplyInfo
    {
        Message = "Hi, I know this!",
        RepliedOn = DateTime.Now,
        UserName = "Judy"
    }
}

If you go through these xml files - xml.zip (1.7 KB), you’ll get following information:

  • User Id
  • Guid
  • Annotation Type (in the form of annotation number like 5 = TextField, 2 = Point etc.)
  • Created on
  • Document Name/Format
  • Document ID
  • Message
  • Replied on
  • Page Number

You can get updated method here - CreateAndGetAnnotation.zip (1.0 KB). Please let me know if you can get same information at your end as well.


#7

Thanks, this works perfectly for programatically comments !

Do you know if the same result is possible with manual added comments ?


#8

@JeanClaudePatrick,

We are investigating this, your investigation ticket ID is ANNOTATIONNET-1016. As we have any further update, we’ll notify you.


#9

@JeanClaudePatrick,

We have update on ANNOTATIONNET-1016.
Please note that the Xml file generates when annotations or replies are added to storage. However, if annotation is not in the storage you can get them by using AnnotationImageHander.ImportAnnotations method. This method takes Stream with annotated document.


#10

Hi,

I have updated the API to 19.4.1 and tried this method but I can’t get the comments in my txt file. Here is my code and the result.
code.zip (782 Bytes)
What am I doing wrong ?


#11

@JeanClaudePatrick,

Do you get annotation replies/comments in xml file?


#12

The xml file is the same as previously


#13

@JeanClaudePatrick,

We are further investigating this. You’ll be notified as we have any further update.


#14

@JeanClaudePatrick,

Please note that it may matter how exactly you add annotations. GroupDocs.Annotation for .NET API may not detect some of annotations that was added not by it (that are manually added).
Could you please share a document where you added annotations manually?