PDF Rendering on iPad's

  • Hi All,

    I have a few questions about rendering PDFs and wondered if anyone
    here could help.

    I've inherited some code that tiles the PDF, I think this code was
    based on one of the Apple Sample Apps from a while back.

    I'm rendering a PDF on an iPad, it's a magazine with lots of text and
    obviously we'd like to run as fast possible, one thing that gives an
    impression of "slowness" is the fact that it renders from bottom up,
    so my first question, is there anyway I can make to render top down?
    The idea is that when a user is presented with a page, that naturally
    start reading from the top down, and since it's just a blur when
    initially rendered it makes the experience less than pleasing.

    The next thing is that I remember seeing some an article with some
    sample code somewhere that altered the rendering parameters depending
    on the type of iPad being used, e.g. iPad1, 2 or 3 (it probably
    handling iPhone too, but I don't need to do that), but I can't for
    the life of me find the exact article I read. I have found some code
    on StackOverflow but doesn't seem complete. So if anyone could point
    me to a some sample code that optimizes for the type of device or
    documentation that explains what needs to be done, I'd be really
    grateful.

    Thanks in advance
    Cheers
    Dave
  • Dave,

    > I have a few questions about rendering PDFs and wondered if
    > anyone here could help.

    In my open source iOS PDF viewer (https://github.com/vfr/Reader) I employ
    two techniques:

    1) Show a low resolution image of the page below the CATiledLayer-based
    zoom-able page view. These low resolution page images are generated on a
    background thread and are also cached as PNGs for future use. This gives the
    user something to see while CATiledLayer draws in the details on top of it.

    2) Reduce the number (and increase the size) of tiles that CATiledLayer asks
    to be drawn. I set the CATiledLayer's tile size to either 512 or 1024 pixels
    depending on the device's screen size and scale (CATiledLayer limits the
    tile size to 1024 pixels). If the screen scale is greater than 1.0, I set
    the levelsOfDetailBias to 1 (any higher and CATiledLayer asks for many,
    smaller tiles). I also return a small value for +fadeDuration (as returning
    0.0 exposes a bug in CATiledLayer - sometimes a tile won't draw or flickers
    in and out until you touch the screen). All of this is done in a
    CATiledLayer subclass
    (https://github.com/vfr/Reader/blob/master/Sources/ReaderContentTile.m)
    which is used to back the PDF page content UIView.

    You should also be aware that there is a bug in iOS 5.1.x where CATiledLayer
    will ask for the same tile to be drawn 2 or 3 times.

    If there is anything else, let me know...jo
previous month july 2012 next month
MTWTFSS
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today