Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

App crash when call Page_setAnnotEditText

More
IP: 192.168.0.70 12 years 4 months ago #3930 by superpisu
HI,

When i call Page_setAnnotEditText app crash with EXC_BAD_ACCESS

this is my code


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?
More
IP: 192.168.0.70 12 years 4 months ago - 12 years 4 months ago #3933 by radaee
char annotText[1024];
Last edit: 12 years 4 months ago by .
More
IP: 192.168.0.70 12 years 4 months ago #3938 by superpisu
crash at this line : bool ret3 = Page_setAnnotEditText(currentPage, myannot, [@"test" UTF8String]);

not use annotText
More
IP: 192.168.0.70 12 years 4 months ago #3957 by stronglee
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]);
More
IP: 192.168.0.131 12 years 3 months ago #4140 by emanuele
Hi,

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

I will use it to test Page_setAnnotEditText method
More
IP: 192.168.0.151 12 years 2 months ago #4533 by emanuele
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
Time to create page: 0.448 seconds
Powered by Kunena Forum