- Posts: 14
- Thank you received: 0
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 while rendering page
- Navdeep_rs
- Topic Author
- Offline
- New Member
-
Less
More
IP: 192.168.0.71
11 years 11 months ago - 11 years 11 months ago #5949
by Navdeep_rs
App Crash while rendering page was created by Navdeep_rs
I am using this code to open PDF
-(void)OpenPDFFile
{
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
NSString *pdfFullPath = [documentsPath stringByAppendingPathComponent:@"ios7.pdf"];
PDFFileStream *stream = [[PDFFileStream alloc] init];
[stream open:pdfFullPath];
[self PDFOpenStream:stream :nil];
/* This works fine*/
//[self PDFOpen:pdfFullPath :nil];
int pageno =1;
// [m_pdf initbar:pageno];
[self PDFThumbNailinit:pageno];
}
When i use "PDFOpen" method to open PDF it works fine, but when i try to open file stream using "PDFOpenStream" method, app crashes at this method.
-(bool)render:(PDFDIB *)dib:(PDFMatrix *)mat:(int)quality
{
return Page_render(m_page, [dib handle], [mat handle], true, quality);
}
In ur sample, when I use "PDFOpenStream" in "selectRightAction" method it works fine. but when i shift this(selectRightAction) method to RDAppDelegate, to bypass RDFileTableController page and open RDPDFViewController directly, same crash occurs. Although "PDFOpen" method works fine from there.
I have no idea whats happening here, what m i missing? Please help.
-(void)OpenPDFFile
{
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsPath = [paths objectAtIndex:0];
NSString *pdfFullPath = [documentsPath stringByAppendingPathComponent:@"ios7.pdf"];
PDFFileStream *stream = [[PDFFileStream alloc] init];
[stream open:pdfFullPath];
[self PDFOpenStream:stream :nil];
/* This works fine*/
//[self PDFOpen:pdfFullPath :nil];
int pageno =1;
// [m_pdf initbar:pageno];
[self PDFThumbNailinit:pageno];
}
When i use "PDFOpen" method to open PDF it works fine, but when i try to open file stream using "PDFOpenStream" method, app crashes at this method.
-(bool)render:(PDFDIB *)dib:(PDFMatrix *)mat:(int)quality
{
return Page_render(m_page, [dib handle], [mat handle], true, quality);
}
In ur sample, when I use "PDFOpenStream" in "selectRightAction" method it works fine. but when i shift this(selectRightAction) method to RDAppDelegate, to bypass RDFileTableController page and open RDPDFViewController directly, same crash occurs. Although "PDFOpen" method works fine from there.
I have no idea whats happening here, what m i missing? Please help.
Last edit: 11 years 11 months ago by mehmetalishaqiri.
IP: 192.168.0.71
11 years 11 months ago #5952
by radaee
Replied by radaee on topic App Crash while rendering page
maybe some issue in PDFFileStream class.
IP: 192.168.0.71
11 years 11 months ago #5953
by radaee
Replied by radaee on topic App Crash while rendering page
OK, it seems you shall maintance stream object till Document object closed.
- Navdeep_rs
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 14
- Thank you received: 0
IP: 192.168.0.71
11 years 11 months ago #5954
by Navdeep_rs
Replied by Navdeep_rs on topic App Crash while rendering page
Thnx @radaee, that did a trick.
Time to create page: 0.404 seconds