views:

430

answers:

2

I'm currently making an iPhone app that has PDF viewing a crucial part of its functionality.

However many of the PDFs aren't iPhone friendly and require zooming and panning to read them. Is there anything I can do to make them better whether with the PDF itself or programmatically? (I'm currently using a UIWebView PDF viewer by the way.)

+2  A: 

Reflowing PDF can be extremely difficult to do, impossible in some cases. Even Adobe confesses to severe limitations with reflowing in its own viewer. This is because PDF, like PostScript (and unlike other formats like Word or HTML), is a page description language.

You will probably only be able to reflow text only, without graphics, and you will only be able to do so in those instances when it is possible for you to extract meaningful text from the PDF (a non-trivial task in itself in the absence of tagging, sometimes virtually impossible.)

Challenges you may encounter with non-tagged PDFs:

  • scanned, non-searchable documents, may require you to perform OCR
  • letters rendered individually, not as part of strings (you will have a hard time determining whether the PDF actually read noted, no ted, not ed, n o t e d, etc.
  • multi-column text, inset text boxes etc.
  • the mapping between text and font may be obfuscated, i.e. letter b may map to the font's A glyph and will render as A -- the only way to resolve this mapping would be to OCR the font, or rasterize the PDF and OCR the whole PDF
  • etc.
vladr
What file format would be the best for this?
Anthony Glyadchenko
My thought would be that HTML would be a better bet for a reflowable document. You could exert a ton of control over a web view to change the CSS dynamically and the document would just reflow.
Kendall Helmstetter Gelner
EPUB would be better...
Rowan
A: 

I'm not sure about what you're trying to do, exactly, but I have some code here that goes into the details of programmatically scrolling a PDF document rendered within a UIWebView. My solution uses private calls, which will cause an app to be rejected, but it demonstrates the general principle.

Alex Reynolds