Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3285752
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:18:07+00:00 2026-05-17T20:18:07+00:00

I’ve been struggling for ages trying to make a working PDF reader for iPhone/iPad,

  • 0

I’ve been struggling for ages trying to make a working PDF reader for iPhone/iPad, but the thing just won’t stop eating memory. It seems that all the pages drawn with CGContextDrawPDFPage are cached internally and never released.

I’m not the only one with this problem: http://lists.apple.com/archives/quartz-dev/2010/Apr/msg00025.html

http://web.archiveorange.com/archive/v/SEb6acvPicMB2NdIjEd3

One response from the first thread:

If this is what I think it is, it isn’t a leak but rather a cache. Instead of retaining the PDF document between calls, try creating the document, getting and drawing the page, then releasing the document when your done.

I’ve tried it, and it solves the problem, but it’s too damn slow. Whereas doing it in the “normal” way (i.e. without loading/releasing CGPDFDocument for every draw) works good and reasonably fast until I reach the 4th or 5th page of the document and it crashes.

I’ve googled this problem for ages: everybody has the same problem but apparently nobody got it working. The only samples I found load a one-page PDF, so obviously everything works fine until you load a document with multiple pages (and of course if the thing has images in it, it crashes even earlier). This is driving me crazy.

So the question is: how exactly do you handle PDF drawing with CGPDF in your app? Any help would be greatly appreciated. Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:18:08+00:00Added an answer on May 17, 2026 at 8:18 pm

    My current Enterprise Project is based round a PDF reader. I don’t release CGPDFDocument and I can page through a 14 page apple pdf with the app maxing at 30mb. I cant give you code but i can point you in the right direction.

    I started a similar thread here: Fast and Lean PDF Viewer for iPhone / iPad / iOs – tips and hints?

    Some tips:

    -Save any media to disk when you can.

    -Use larger tileSizes if rendering on TiledLayers

    -Note that images will render faster than a CGPDFPageRef

    -Use NSOperations to prepare pages ahead
    of time.

    -Recycle page objects

    -Close any open Contexts as soon as you don’t need them

    -on receiving a memory warnings release and reload the DocRef

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I'm looking for suggestions for debugging... If you view this site in Firefox or
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.