2

I have pdf of size 53MB when i try to load only one page of PDF in scrollview i got memory warning and then application crash.

  • your RAM must be insufficient, convert that pdf in a mobile friendly version like .nobi or .epub and than read it – Mr. Alien Oct 02 '12 at 07:20
  • 3
    With a PDF of that size either the streams are uncompressed (easy to rectify), or it contains huge bitmaps, or many bitmaps, or very, very complex vector drawings or thousands of pages. In all those cases another format wouldn't change anything. – Joey Oct 02 '12 at 07:21
  • 1
    I'm also facing this issue while load 21.3 MB pdf with only one page. – Ashvin Oct 02 '12 at 07:22
  • 1
    i suggest to test without using debugger..test the app in the device not from xcode – Mejdi Lassidi Oct 02 '12 at 07:23
  • this could help you, http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints – Charan Oct 02 '12 at 07:37

3 Answers3

1

Display the PDF in a UIWebView:

NSString *PDFPath = [[NSBundle mainBundle] pathForResource:@"filename" ofType:@"pdf"];
NSURL *URL = [NSURL fileURLWithPath:PDFPath];
NSURLRequest *URLRequest = [NSURLRequest requestWithURL:URL];
[webView loadRequest:URLRequest];

The WebView will load pages into memory as they appear on screen rather than all at once.

Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
0

This is a duplicate of What is the best way to view large PDFs on iOS?

The accepted answer is to use a UIWebView as indicated above.

Community
  • 1
  • 1
Simon Epskamp
  • 8,813
  • 3
  • 53
  • 58
0

You should take a look at the vfr/Reader, which is a PDF Reader Core for iOS.

UIWebView is not very good in handling big files out of the box.

Max B.
  • 881
  • 10
  • 21