App crash when call Page_setAnnotEditText - 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

TOPIC: App crash when call Page_setAnnotEditText

App crash when call Page_setAnnotEditText 5 years 3 months ago #3930

  • superpisu
  • superpisu's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
HI,

When i call Page_setAnnotEditText app crash with EXC_BAD_ACCESS

this is my code


PDF_PAGE currentPage = Document_getPage(m_doc, page);
    Page_objsStart( currentPage );
    int annotationCount = Page_getAnnotCount( currentPage );
    NSLog(@"%d",annotationCount);
    if (annotationCount) {        
        PDF_ANNOT myannot = Page_getAnnot(currentPage, 0 );
        int annotType =  Page_getAnnotEditType( currentPage, myannot );
         NSLog(@"annot type = %d",annotType);
        if (annotType==1) {
            
            
            PDF_RECT rect;
            
            bool ret = Page_getAnnotEditTextRect( currentPage, myannot, &rect );
            
            NSLog(@"left %f",rect.left);
            NSLog(@"bottom %f",rect.bottom);
            NSLog(@"right %f",rect.right);
            NSLog(@"top %f",rect.top);
            char annotText=@"";
            bool ret2 = Page_getAnnotEditText( currentPage, myannot, &annotText, 1024);
            
            if ( annotText) {

                NSString *text = [[NSString alloc] initWithUTF8String:annotText];
                NSLog(@"%@",text);
            }else{
            
                NSLog(@"no text");
            }
            
            bool ret3 = Page_setAnnotEditText(currentPage, myannot, [@"test" UTF8String]);

any suggestion?

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

App crash when call Page_setAnnotEditText 5 years 3 months ago #3933

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 847
  • Karma: 43
  • Thank you received: 12
char annotText[1024];

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

Last edit: by .

App crash when call Page_setAnnotEditText 5 years 3 months ago #3938

  • superpisu
  • superpisu's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 0
crash at this line : bool ret3 = Page_setAnnotEditText(currentPage, myannot, [@"test" UTF8String]);

not use annotText

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

App crash when call Page_setAnnotEditText 5 years 2 months ago #3957

  • stronglee
  • stronglee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 92
  • Karma: 1
  • Thank you received: 2
Hi,
example for Page-getAnnotPopupText:

char text[1024];
for (int i = 0; i < 1024; i++) {
text = "";
}
Page_getAnnotPopupText(page, annot, text, 1024);
NSString *ns = [[NSString alloc] initWithUTF8String:text];


when use Page_setAnnotPopupText,there need call Page_getAnnot() before:

PDF_ANNOT annot = Page_getAnnot( page, Page_getAnnotCount(page) - 1 );
Page_setAnnotPopupText(page, annot, [text UTF8String]);

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

App crash when call Page_setAnnotEditText 5 years 2 months ago #4140

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 525
  • Karma: 20
  • Thank you received: 60
Hi,

can you send me your PDF?
Already with the edit text annotation.

I will use it to test Page_setAnnotEditText method

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

App crash when call Page_setAnnotEditText 5 years 2 weeks ago #4533

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 525
  • Karma: 20
  • Thank you received: 60
Hi,

a new version is now available with Page_setAnnotEditText method fixed.

Now you only have to set the annot text, re-render the page and save the m_doc, like this:

[annot setEditText:@"test"];
[m_view vRenderPage:pos.pageno];
[m_doc save];

You can find this implementation in PDFView.m: onSingleTap method.

http://www.androidpdf.mobi/download/download-ios/file/56-ios-pdfviewer-182

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

  • Page:
  • 1
Powered by Kunena Forum