Does anyone have experience with pros and cons of using QLPreviewController vs UIWebView to open pdf and office document? And benchmark data ?
Thanks!
The QLPreviewController can open and display various documents such as office documents, pdf, images, movie files, text documents, etc. It also offers built in air print functionality. When opening movie files all the standard controls are there such as air play etc. It also supports multiple document previews via the QLPreviewControllerDelegate. You get all this for "free" and have to write very little code to get it.
A UIWebView can do much of this, but you will have to write more code to handle it. It will take more work to render images "properly", and you will have to handle movies and audio on your own in some cases. There can also be issues detecting the appropriate text encoding when viewing plain text files.
The QLPreviewController is a much better "all in one" solution. There are other classes available as well if you need even more control then what the QLPreviewController will give you.
Related
Does anyone know if there is a function in PDF's to allow them to auto-adjust the view depending on whether it is on a desktop or mobile? Or even by screen size?
I am looking to prepare PDF material for distribution, however, on the user group includes a mix of desktop and mobile, so instead of creating two PDFs I would like to have a single PDF which adapts to the users screen?
This is not possible with PDF files up to PDF version 1.7, the most commonly used on out there.
PDF 2.0 which was released three years ago has such a feature but it depends on the viewer implementing it and the PDF writer correctly annotating the PDF. I guess there are PDF viewers out there that can already do this but I'm not specifically aware of any.
If I were you, I would write the document in a format like LaTeX that can easily be converted to both kinds of PDFs, one for desktop and one for mobile.
I am working on a website providing massive amount of PDFs for download and I am trying to improve the website accessibility. All I can think of is:
Provide equivalent content for the PDFs when possible (text or HTML for example).
Provide description for the PDF documents before the use can download them.
Make it possible to search within the PDF files when the users use the website search.
Make the links to the PDFs labelled by a nice icon.
Inform the users that they will need a third party application (Acrobat or other PDF viewers) in order to open the documents.
Are there other ways to improve it?
Like Jared said, assistive technology works decently with PDFs. The question is what kind of quality control do you have. There is a few different ways of putting together a PDF. One way is scanning a document and the result is a PDF made out of images. When assistive technology hits it, all it says is image image image, great help right?
Now Adobe built in an Optical Character Recognition ability (second way), which has improved over the years, but is far from quality. For example, I was given a PDF that had OCR on it. One of the first lines had the word Articles, in italics, the OCR spit out Art/e5. The third way is to produce PDFs containing actual text. Now Office 2007/2010, have the ability to save as a PDF. Before hitting save, click the options button and ensure the "document tags for accessibility" box is checked.
PDFs have a tag structure, like HTML, found via the Tags panel/pane. The output in 2010, is a bit cleaner than 2007, but I still recommend something like Commonlook Office to create your PDFs.
4.Make the links to the PDFs labelled by a nice icon.
You could put an icon within the link. Some people do:
Link text <img src=".." alt="PDF icon"/>
Some people using assistive tech just browse via links, so they won't know it is a PDF before they open it. So, it is better to do:
Link text <img src="" alt="PDF"/>
5.Inform the users that they will need a third party application (Acrobat or other PDF viewers) in order to open the documents.
It is a good idea to do this, in fact Section 508 requirements say to do this. I recommend linking to Adobe Reader for two reasons.
1- if the person does not have a PDF viewer, they'll probably call their "computer expert" who probably heard of Adobe Reader, and knows the site isn't pushing some ad-ware.
2- Adobe Reader has the most built-in accessibility of the readers out there, to my knowledge. So, why would you not give the best.
There are several things you can do to improve the accessibility of the PDFs themselves.
Provide "Alternate Descriptions" for images
Provide "Replacement Text" for items such as equations or abbreviations
Replacement Text can also be used to hint at the pronunciation of names
Mark the language, especially if it is mixed
This will assist a screen reader in properly understanding the PDF. This isn't crucial for pages that contain only text in regular paragraph layout - the reader can usually figure things out. If there are pictures, captions, jargon, names, etc, this will greatly improve the reader's performance.
In iBook, when you open a PDF, you can auto format and paged the pdf, e.g. if in iPhone, there are 5 pages, but when you view with iPad, it only contains 2 pages.
When you change the text size, the page also updated automatically.
How to do this using CGPDFDocumentRef?
I'm assuming you are talking about Apple iBooks on the iPad? Are you sure you are observing the behavior of a PDF and not an ePub file?
The native format of iBooks is either ePub or the format created by iBooks Author.
PDF files are usually (in the vast majority of cases) used in a non-reflowing way. Reproducing the exact visual appearance of pages - explicitly without reflow - is exactly why PDF was invented.
There are constructs you can add to PDF files to make them a little more alike to formats like HTML and ePub; these constructs can tag text with styles, logically define paragraphs, columns and tables and so on. Usually they are used to make a PDF file suitable for long-time archiving (according to the ISO PDF/A standard) or accessible (suitable for reading by screen-reader software for vision-impaired people for example). Such a PDF file is commonly referred to as a tagged PDF.
As far as I know iBooks doesn't actually support tagged PDFs (meaning, it doesn't use the information in such a PDF file to reflow the file). And as far as I know you cannot create the necessary tags and structure with the built-in iOS library.
If your target app is iBooks, you'd probably be better off looking into generating ePub...
I'd like to make my app to open a specified PDF by an external app of the user's choice on the iPad. How can I do that? Or, is there any open-source PDF reader framework available so that I can put it into my app?
My situation in more detail:
I'm thinking of porting to the iPad from OS X / rewriting from scratch for the iPad an app which manages lots of PDFs (journal articles, etc.), but I don't want to write the PDF reader part, because there are many good ones already out there; I don't want to reinvent the wheels.
(You might say you shouldn't reinvent pdf management apps, but I'd like to make one as a front end to SPIRES, and there isn't one so far.)
As the app would be a front end to a serious reading activity, UIWebView's pdf capability is not enough.
Also, users of my app would have various preferences which app to use.
That's the background behind my question. Thanks in advance!
Here's my self-answer:
Use UIDocumentInteractionController. See this Apple doc.
The problem now is to find a way to choose programmatically exactly with which app you open a document, when multiple apps are available to a same file type.
Its not that hard to view PDFs without a UIWebView. You use some Quarts 2D drawing but a large majority of the work is done for you. You mainly have to choose how you will flip pages, and do pinch to zoom.
Quarts 2D PDF reference
You aren't able to search inside of PDF files. You can't access the text. You could do annotation, but it would be a hack at best.
I've already referred to this SO post. I've been embedding images using an AlternateView for PNG files. Now I'm wondering how to do it with PDFs.
Should it work, for the LinkedResource, to just say:
Dim document As New LinkedResource(pdfFilePath, "image/pdf")
I'm just trying to figure out how to get the PDF to be embedded like I could with an image, or is that not possible and I'll have to do it as an attachment?
You can embed images since they can be rendered in place by an email client. PDFs cannot do that, so I'd recommend either having a thumbnail of the PDF that links to your web site with the actual PDF. Or just attach the PDF to the email message.
There are a few options that I know of.
1) Is the simplest way okay? The easiest by far would be to attach the PDF as a normal attachment. Then render the first page of the pdf as an image, embed it in the email and link it to open the PDF if you can. Entourage kind of does this on the Mac.
Alternatively, what I found was the following:
2) FLASHPAPER embedded in HTML displaying a PDF. Adobe has a technology called Flashpaper. It is a flash based file viewer. You can use flashpaper format documents that go into it, or PDFs as the source.
Check out some examples. That's really flash. http://www.adobe.com/products/flashpaper/examples/
Assuming you send an HTML email that will get through (images aren't turned off, etc), you can can embed the Flashpaper viewer right in your HTML code as a normal Flash object.
Most HTML email clients use Internet Explorer Bits, Webkit bits, or Gecko bits to render the html. Flash player is pretty well installed on everything, so it works well. A good example of this is when we open an email and it has video playing in it. It's almost always Flash.
I have had luck doing it this way -- the only thing you'd have to decide is if most of your clients can see this and how much (if any) today's software might block it.
What I ended up doing was a hybrid. 1) Attach it to the email, 2) Embed the Flashpaper viewer. They get it either way.
Flashpaper is available seperately for $75. It has come in handy where the client was not able to install adobe acrobat on each computer and it had to be 100% web based.
I would imagine you should be able to do the same using any language with a little more effort and using something like Flashpaper.
Hope that helps
This is not possible--at least not in a way that will work with many clients. You'll need to just attach the file.
If you have only one client to worry about, it might be possible--but not likely without manually changing settings on each client.
The MIME type of a PDF is "application/pdf" not "image/pdf"