Optimize PDF Documents for Mobile Rendering

Rendering PDF documents is a complex task. PSPDFKit has to parse and traverse the entire render tree for every page and zoom operation. There are certain aspects that are supported within the PDF spec but that come at a great cost when being implemented. Mobile devices are limited when it comes to resources and processing power, so optimizing your PDF documents can be beneficial for both performance and battery.

Below are some tips that may help.

Reduce Image Size

Unnecessarily large images take up precious memory, even when they are not able to be displayed in their full resolution on the smaller screens available on phones and tablets. That’s why it’s always a good idea to downsample those images.

Adobe Acrobat provides an easy way to do this:

  • Open your document in Adobe Acrobat.
  • Go to File > Save as Other > Optimized PDF.
  • Under Settings, select Mobile as a preset. It already contains settings that are optimized for displaying PDFs on mobile devices.
Reduce image size

Avoid Using JPEG 2000 for Image Compression

JPEG 2000 is an image format similar to JPEG, but it has slightly better image quality when two files of the same size are compared. However, this little improvement comes with a massive downside, as decompressing these images is much more complex. Often, this kind of image compression is the root cause of pages taking a very long time to render.

Checking If the Document Contains JPEG 2000 Images

In order to check if your document contains JPEG 2000 images, open it with Adobe Acrobat and select Edit > Preflight > PDF/A compliance > Verify compliance with PDF/A-1a. If your document contains the JPEG2000 compressed images, they will show up.

Recompressing Images to JPEG

To recompress JPEG 2000 images to JPEG in your PDF document, open it with Adobe Acrobat and select File > Save as Other > Optimized PDF. When setting the image settings, make sure you turn off downsampling and change the compression from JPEG 2000 to JPEG.

Converting JPEG2000 to JPEG

As an alternative solution, you can open your document with Adobe Acrobat and select Edit > Preflight. Then, under PDF fixups, double-click on Recompresses color and grayscale images to JPEG (high quality) to select the fixed document destination and perform the recompression.