How Do You Deal with Large PDF Portfolios?

| No Comments

Actually, this post can apply to any large PDF that has any objects in it that might prevent the normal "Fast Web View" feature in Acrobat or Reader from displaying the PDF in the browser quickly.

Saving a PDF with "Fast Web View" restructures a PDF document for page-at-a-time downloading (byte-serving) from web servers. With Fast Web View, the web server sends only the requested page, rather than the entire PDF. This option is especially important with large documents that can take a long time to download from a server. For PDFs with static content like text, line art, and images this works great. You can browse through a PDF that’s thousands of pages very quickly without downloading the whole thing first.

“Fast Web View”, while functioning correctly, may not be effective when
loading PDF files containing large objects such as embedded videos or file attachments. To maintain backward compatibility, a PDF Portfolio is basically a PDF with a bunch of attachments and some extra stuff in the catalog object. When these kinds of files are encountered, Acrobat or Reader appears to hang when in reality it’s just reading a really big chunk of data from the server.

So back to the original question…

How Do You Deal with Large PDF Portfolios?
There are a number of ways, but here’s one that’s ridiculously easy if you have administrator rights to an Apache web server or even just a directory on it. By the way, this solution has nothing to do with Acrobat, Reader or PDF, it’s just basic server management.

Byte-Serving the PDF is fast. But… it’s not nearly as fast as just forcing the whole PDF to download rather than opening it in the browser. To do this, set the Content-Disposition to "attachment" for that file. On any web server, you can do this by serving the PDF up via a script and setting Content-Disposition in the HTML headers but with Apache it’s easier than all that. This may also work on other servers but I haven’t tried it.

I created two separate directories on my server. One called "view" and one called "download". In the "download" directory, I added a file called ".htaccess" that allows me to customize the server response to any request for a file from that directory. It contains a single line of code.

Header set Content-Disposition "attachment"

This allows me to create links to PDF files in the "download" directory and the end user will be prompted to download the file rather than have it open inside the browser. The following two links will behave very differently even though the <a href=> tag is basically the same and the PDFs are identical except that they are being served up from different directories. If you hover over the link, you’ll be able to see the destinations. The behavior is determined by the directory on the server, not any script or parameter in the <a href=> tag.

  This PDF Opens in the browser – It’ll look like it hangs your browser but if you wait long enough it’ll show up.

This PDF will download to your desktop – You can open it once it’s finished. Personally, I think this is a better experience when “Fast Web View” won’t do the trick.

Sorry, the comment form is closed at this time.

Sorry, the comment form is closed at this time.