FAQ: Guidelines for publishing PDF files for use with the Web Viewer

When publishing PDC files for use with the Web Viewer it is important to make sure that the underlying PDF files are optimized and properly constructed.  By not following the guidelines below, users may end up with a poor experience using your protected documents.

The most common issues are:

  • long load times
  • pages not being fully displayed (only parts of them show up)
  • images not displaying correctly
  • partial loading of the document (pages missing)
  • documents not loading at all but displaying an error message such as “an error occurred while rendering the page”
  • documents not printing, or printing with missing pages

These issues are usually all related to the underlying PDF file that was protected and the elements embedded in the PDF document.  While the Locklizard installed Viewers can access and use memory efficiently and thus, render the document correctly, the Web Viewer is limited by the browser environment.  This means that particularly complex elements cannot be rendered in full on some pages, since documents are loaded entirely into volatile memory (for security purposes) and decrypted one page at a time.

Types of elements that will cause problems are:

1.  Complex shapes / vectors

Because vectors are comprised of points (each with location, curves and other values) and lines, they take up much more memory than a raster image (usually about 10 times more).  This leads to only parts of the shape being displayed, especially for complex vectors made up of tens of thousands of points.

SOLUTION:  Use the Web Publisher optimization option “Flatten all Pages” * when protecting files to the Web.  If you need to also provide a high-resolution print option, then it’s advised to have a version of the document which will be opened and printed from within the normal Viewer (a version that is not flattened).  Note that hyperlinks will no longer work in flattened PDF files, and flattening PDF files will dramatically increase the file size.  See the section entitled ‘Flattening Documents’ below.

2.  Embedded PDF files

Embedding PDF files will cause memory usage to spike and the document to either load very slowly or not at all.

SOLUTION:  When creating your PDF files make them as clean as possible with the minimum number of embedded objects.  Don’t embed PDF’s into another file (say an Illustrator file) and then PDF the final Illustrator file, or embed multiple PDF’s within a single file.

3.  The use of very high resolution images

As with the other cases, memory usage will spike and may lead to rendering issues.

SOLUTION:  Resize the images used to the dimensions of the page before adding them to the PDF document.  This can be done in MS Paint or with any free image editing software.  Also decrease the image resolution to say 72dpi if document printing is disabled, or 300dpi if printing is enabled.

4.  Saving the PDF file with layers

Saving a PDF file with layers will lead to larger, much more complex files that will be more difficult to render and display and print.

SOLUTION:  Flattening the document * (optimize the PDF whilst also lowering the DPI) will normally remove the elements and solve the display and printing problems.  See the section entitled ‘Flattening Documents’ below.

5.  Errors in the document

Sometimes, when creating PDF files, pages may become corrupted or the additional data inside a PDF file turns out to be incorrect.  This can also lead to display issues, even though it’s not related to an actual element on the page.

SOLUTION:  For Adobe Acrobat, open the file, then go to File -> Save As -> save it with a different name (or the same name, to another location).  Upon saving, Acrobat will automatically fix the errors.  With Nitro PDF you can also create a new document, then choose “insert pages” from the original PDF file.

6.  Large file sizes

It is important to consider that the larger a file, the more complex it is, and the greater number of pages present, will have an effect on the loading, rendering, and printing of documents.  This is especially true if printing is enabled for since the whole document (every page) is loaded into memory in one go rather than a page at a time.

SOLUTION:  Make sure you have optimized the PDF file as much as possible using Safeguard PDF Writer, using the guidelines above, and using the optimization settings in Web Publisher.

7.  Having very complex pages, comprised of many individual elements

If you have many elements on a page (images, texts, logos, page numbers, fonts, shapes, etc.) then rendering it will become difficult and time consuming.

SOLUTION:  Try to group similar elements into the same one.  For example if you have multiple images displayed together (say a bunch of images all in one line or a section of the page), group them together into just one image (if they are vector images rasterize them) and add the one image to the PDF page instead.

8. Scanned copies of PDFs

These are effectively image files so will consume a large amount of memory and will cause printing to be slow or crash the browser.

SOLUTION:  Re-create the PDFs with optimized settings in Adobe Acrobat and use the Save As feature ‘Mobile Compatible’.  Most problems should diminish if scanning is done through Acrobat XI Pro.  See also this article on creating mobile ready PDF files.

File still not displaying?

If you have tried all the options above, and the PDF file is not displayed in the Web Viewer or keeps loading but nothing is displayed, then re-protect the PDF but this time turn OFF the PDF Optimization options in the Writer.  Then when publishing to Web turn OFF the PDF Optimization options in Web Publisher.  Sometimes options like ‘remove unused streams’ can break the document as it removes vector data inserted by an application that is required for the document to function correctly.

Flattening documents

If your documents consist of more than 10 pages then we do NOT recommend flattening them using Safeguard as this will create a bitmap image that will increase the file size and take much longer to load.  Instead we recommend that you optimize your PDF files using the product you create your PDF files with.  The following articles provide useful information on merging layers, combining fragmented images and reducing file sizes: