Text Annotations are not parsed - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about iOS development and PDF
  • Page:
  • 1
  • 2

TOPIC: Text Annotations are not parsed

Text Annotations are not parsed 1 year 9 months ago #11801

  • valkuz1
  • valkuz1's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
Hi,

Apart from editing the PDF document via viewer (which I do successfully!), I need to do the following:

Just open the pdf file and prefill some text into text fields. (Without viewer)
However, when I open the PDF like this:

[doc open:_pdfPath :@""];
int pages = [doc pageCount];
for(int index = 0; index < pages; index++){
PDFPage *page = [doc page:index];
[page objsStart];
int annots = [page annotCount];
for(int annot = 0; annot < annots; annot++){
PDFAnnot *annotation = [page annotAtIndex:annot]; //iterate over annots
// I will get only these, fieldType of which is 1 or 4, but not 2!
}
}

I get only annotations of type 1 and 4, but none of type 2.

But, when I open the pdf via pdf viewer, I am able to edit text fields (and also use annotAtIndex methods and etc to correctly get my text annotations)

So,
1)Why the text annotations are not parsed?
2)What should be done?

Thanks.

Please Log in or Create an account to join the conversation.

Text Annotations are not parsed 1 year 9 months ago #11804

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 516
  • Karma: 15
  • Thank you received: 56
Hi,

can you share the document used to test the reader?
We will check it to better understand the issue

Please Log in or Create an account to join the conversation.

Text Annotations are not parsed 1 year 9 months ago #11805

  • valkuz1
  • valkuz1's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
Any document, various pdf versions - from 1.3 to 1.7, but for instance this, which is in the attachment.
Attachments:

Please Log in or Create an account to join the conversation.

Text Annotations are not parsed 1 year 9 months ago #11806

  • valkuz1
  • valkuz1's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
When I open it via viewer, I can edit and save fields as I normal, but when I just want to do it programatically (open doc and iterate over the annots in order to fill the document), I get only these of type 1 and 4 (checkmarks and sigs), but not type 2( text fields)

Please Log in or Create an account to join the conversation.

Last edit: by valkuz1.

Text Annotations are not parsed 1 year 9 months ago #11808

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 516
  • Karma: 15
  • Thank you received: 56
Hi,
I tried to iterate over the annotations of your pdf with this code (almost equal to your):
PDFDoc *doc = [[PDFDoc alloc] init];
    [doc open:filePath :@""];
    
    int pages = [doc pageCount];
    for(int index = 0; index < pages; index++){
        PDFPage *page = [doc page:index];
        [page objsStart];
        int annots = [page annotCount];
        for(int annot = 0; annot < annots; annot++){
            PDFAnnot *annotation = [page annotAtIndex:annot]; //iterate over annots
            
            NSLog(@"Annot index: %i", [annotation getIndex]);
            NSLog(@"Annot edit type: %i", [annotation getEditType]);
            NSLog(@"Annot field type: %i", [annotation fieldType]);
            NSLog(@"Annot type: %i", [annotation type]);
            NSLog(@"Annot value: %@", [annotation getEditText]);
        }
    }

The annotation count is 62 and the log shows the edit fields correctly.
The annotation at index 0 is an edit text annot (type:20, field type:2); what is the result if you try to call [page annotAtIndex:0]?

Please Log in or Create an account to join the conversation.

Text Annotations are not parsed 1 year 9 months ago #11809

  • valkuz1
  • valkuz1's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0
sec

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
  • 2
Powered by Kunena Forum