When you use the compression API, select the level of compression you want to apply to your PDF file in the compression_level setting.
We provide three standard values for compressing your PDF document:
- High. Choose High compression to make the PDF file as small as possible. This may reduce the quality of the output. If you choose High, you may see a difference in the way the PDF document renders when you print it or open it in a viewing tool.
- Medium
- Low. Preserve the quality of the PDF file even if the file ends up being larger.
We also provide a fourth value, Custom.
If you choose Custom, you can define your own settings for compressing the PDF file by editing the values and settings in a JSON profile file. So if you select Custom you need to create a JSON profile. We provide a sample JSON profile file you can use as a model, but you will need to enter your own settings.
We describe how to edit that JSON profile file below.
Choosing a standard value
The settings we use for High, Medium, and Low are the same as those used for Custom. But for High, Medium, and Low, we define those settings for you. All you need to do is choose one of these three options.
You are likely to wonder what’s the difference between High compression and Low compression for your PDF document. That's why we describe these three standard settings briefly below. For more detailed information about how the system defines the High, Medium, and Low settings, look at the descriptions of the Custom settings under Choosing the Custom value.
Images |
High | Medium | Low |
Quality. Final quality of images in PDF file after compression. | Minimum. Compress images aggressively to reduce the size of the PDF file. | Medium | Maximum. Protect the final appearance of the images at the cost of a larger file size. |
Fonts |
High | Medium | Low |
Remove fonts | Remove all unneeded fonts. Subset, remove unused fonts, consolidate duplicate fonts, and unembed base 14 fonts. | Same as High, but don’t subset fonts | No font changes |
Objects |
High | Medium | Low |
Discard objects embedded in the PDF document to make it smaller | Throw away everything, including embedded JavaScript code, bookmarks, thumbnails, & other objects | Remove alternate images only | No object changes |
User Data |
High | Medium | Low |
Discard metadata and information in the PDF document to make it smaller | Throw away metadata, comments, attachments, and other specialized content | No user data changes | No user data changes |
Cleanup |
High | Medium | Low |
General file compression settings | All file compression settings turned on | All file compression settings turned on | Only compress document structure and optimize file |
Color Conversion |
High | Medium | Low |
Color management | Color conversion enabled. Decalibrate, switch to standard profile srgb | Color conversion turned off | Color conversion turned off |
PDF documents are designed to make sure that the text always appears consistently across all printers and viewers by using the same set of fonts found in the source document. That means that the font files needed to create these fonts are embedded in the PDF document itself. That way, the printer or viewing tool (like Acrobat) doesn’t have to look for fonts on the local machine, or substitute fonts if the correct one is not found. But embedding fonts in a PDF file can make the PDF quite large. It is also possible to embed a subset of the fonts in an embedded font in the PDF, so that only the characters that are needed to render the document are saved internally. This PDF Cloud option also allows you to remove common fonts (Base 14) that are found on nearly any standard laptop or workstation, remove duplicate fonts, and remove unused fonts.
The “cleanup” settings describe general steps to take to compress the entire PDF file. You can try to compress the entire file, or only the document structure, which features tables and information about the file itself. You can also select cleanup options to change compression utilities used, and linearize the document, which makes it load more quickly in a browser window.
PDF documents manage colors internally, so that headings, graphics, and images appear with consistent colors regardless of the printer or viewer used to render those files. The colors are defined in a file, saved in the PDF document, called a color profile. Normally the PDF will default to a standard color profile included in the PDF document. But you can select a smaller profile to use, or “decalibrate” the file, removing the color profile and prompting the viewer to find a color profile on the local laptop or workstation.
Choosing the "Custom" value
Your JSON profile file should include a list of settings that define exactly what kinds of changes you want to apply to your PDF document. You can make your custom profile file as long or as short as you need, depending on the types of changes you plan to apply to optimize your PDF document.
We offer a variety of options to use when optimizing a PDF document. The options you select will depend on how you want to change your output PDF documents, and on your goals.
Suppose you have a PDF document that is 18 MB and you want to make it smaller so that the file will be easier to distribute online. If you expect that your readers will be opening the file in a browser window, and it doesn’t matter if the photographs and diagrams in the document appear with a lower resolution, you could make the document smaller by compressing the images included in the file.
On the other hand, if you are working with a large PDF document that your customers are likely to want to print, but you want to make it smaller so that it downloads and prints more quickly, you probably want to leave the graphics alone. They will need to appear as sharp as possible. But you don’t need interactive content, like form fields, bookmarks, comments, or digital signatures. You can use this Custom JSON profile feature to remove items from the PDF document that will not appear on paper.
Or maybe you are building a PDF document that you intend for people to read on smart phones and other mobile devices. In this case you want to compress the document so that it opens as quickly as possible. So you would reduce the size of the images in this case as well, but given that the screens are a lot smaller than a laptop or desktop monitor, you can reduce the resolution of the images in the PDF document to be less than a PDF document that is intended for opening in a browser window.
All of the settings for compressing a document are optional, and are turned off by default. That means then that a setting is only applied if it is included in the JSON file. Flag settings must be enabled, or set to "ON" if the flag is an On/Off value. Settings that are turned off do not need to be defined in the JSON profile file. So if you wanted to you could create a custom JSON file with only a single setting, to compress images. Your JSON file might only hold five or six lines of text.
Only use lowercase characters for the keys and values you add to the JSON profile file.
The methods you can use to optimize a PDF document are sorted into nine categories:
Images | When a PDF document is created that includes photographs, diagrams or drawings, the original graphic file, such as a JPEG photograph or a PNG image, become images in that PDF file. You can enter settings in the JSON profile file to compress these color, gray scale, or black & white images. | |
Fonts | PDF documents can travel with the fonts that they need to access to properly render text. Font files can be embedded within the PDF itself. That way, no matter what machine is used to open a PDF file, the PDF is always guaranteed to look the same, and the viewing tool does not need to look for substitute fonts installed on the local desktop or laptop. But these embedded font files can make the PDF larger, maybe a lot larger, if the document needs to express characters from an Asian font set, like Mandarin or Japanese. You can enter settings in your JSON profile file to remove individual font characters or sets that you don’t need, thus reducing the size of the PDF file. | |
Transparency | It is possible to stack objects, such as graphics, images, text boxes, and form fields, on top of each other on a PDF document. These objects can be partially or fully transparent, and thus can interact in various ways with objects behind them. If a set of transparencies are stacked in a PDF file, each one contributes to the final result that appears on the page, such as the colors blending together into a final color that appears.
To make a PDF document simpler you can flatten these transparencies. The flattening process combines the layers of content on a PDF page, or a stack of transparent images or colors, and renders the result as a single image, blended color, or set of text. For example, if a digital signature is flattened, the digital certificate key and related properties are removed from the signature field. The name of the person who signed the document and related information, such as the date and time stamp and the signer’s email address, appear on the page as text, but the signature field is no longer interactive. To flatten the transparencies within a PDF document, there needs to be a "transparency/quality" section in the JSON profile file. |
|
Objects | Besides graphic images and font files, a variety of other objects can be saved within a PDF document.
Use the compression feature to remove any of these objects from a PDF document. This serves to make the document smaller and easier to distribute. |
|
User Data | It is possible to edit PDF documents using Adobe Acrobat and other viewing and editing tools. For example, when reviewing the content in a PDF document, a user might want to add a comment. It is also possible to attach external files to a PDF document so that the file is saved as a part of the PDF, or embed a hyperlink to a web page. Finally, a user could add metadata. The compression feature can remove any of this content. It can also remove form fields, such as text boxes, check boxes, and radio buttons. | |
Cleanup | Use the Cleanup features to set compression values for a PDF document. You can compress the entire PDF document or parts of the content, and you can also remove redundant content or select a compression method to use, as well as other changes designed to make a PDF document open more quickly. | |
General | These options affect the PDF document as a whole, rather than individual features, like images or fonts or bookmarks. The setting provided under General allows you to force the compression feature to generate a PDF output document even if this document will be larger than the input document it is intended to replace. | |
Color Conversion | You can turn on this feature to convert the colors in a PDF document to a color profile you select before compressing that document. |