Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC:

App crash when call Page_setAnnotEditText 10 years 7 months ago #3930

  • superpisu
  • superpisu's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • 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 10 years 7 months ago #3933

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 1123
  • Thank you received: 73
char annotText[1024];

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

Last edit: by .

App crash when call Page_setAnnotEditText 10 years 7 months ago #3938

  • superpisu
  • superpisu's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • 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 10 years 7 months ago #3957

  • stronglee
  • stronglee's Avatar
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 93
  • 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 10 years 6 months ago #4140

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
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 10 years 4 months ago #4533

  • emanuele
  • emanuele's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 580
  • Thank you received: 67
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.

www.androidpdf.mobi/download/download-io...56-ios-pdfviewer-182

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

  • Page:
  • 1
Powered by Kunena Forum