Page tree
Skip to end of metadata
Go to start of metadata

IPDFOutput::setParameter

IPDFOutput supports several parameters that control how the PDF is written. These can be set in code in two ways. For example, to set the version of PDF that will be written, the code is

Setting an output parameter in code
IPDFOutputPtr output = IPDFOutput::create(jawsMako);
output->setVersion(IPDFOutput::ePDF1_4);

The same parameter can be expressed as two strings:

Setting an output parameter with strings
IPDFOutputPtr output = IPDFOutput::create(jawsMako);
output->setParameter("PDFVersion", "1.4");

This method was added to support scenarios where it is necessary to set an output parameter at runtime, for example in a printer driver where the user is offered options from a menu.

makoconverter allows you to experiment with these parameters by adding them to the command line, for example:

makoconverter MyInput.pdf MyOutput.pdf pdfversion=1.4 TargetColorSpace=DeviceGray ConvertAllColors=true
makoconverter MyInput.pdf MyOutput.pdf preset=PDF/X-4

The following settings are supported.

Parameter

Possible values

Description

PDFVersion

1.3

1.4

1.6

1.7

2.0

PDF/A-1b

PDF/A-2b

PDF/X-1a

PDF/X-4

Sets PDF version. The default is 1.7.






For PDF/A, consider using a PDF/A preset


For PDF/X-4, consider also setting an output intent with the TargetProfile parameter, or use the PDF/X-4 Preset

RenderResolution

1 to 32768

Sets the resolution of page portions that must be rendered, for example to flatten transparency. The default is 300dpi

RenderedImageCompression

Auto

Flate

DCT

LZW

RLE

Set the desired image compression for images that are the result of rendering. The default is eICFlate. If set to auto, flate will be used.

Note: this is advisory only and may not be honored in all cases. For example, PDF/A does not allow LZW.

MonoImageDownsamplingResolution0 to 32768The desired output resolution, in dpi. Pass 0 to leave images unchanged, which is the default.
MonoImageDownsamplingThreshold0 to 32768

The threshold above which images will be reduced to the desired resolution. Pass 0 to use the resolution.

MonoImageDownsamplingMethod

Subsample

Average

Bicubic

The method to use when downsampling. The default is subsample for monochrome images; using any other method will result in grayscale output.

GrayImageDownsamplingResolution0 to 32768The desired output resolution, in dpi. Pass 0 to leave images unchanged, which is the default.
GrayImageDownsamplingThreshold0 to 32768

The threshold above which images will be reduced to the desired resolution. Pass 0 to use the resolution.

GrayImageDownsamplingMethod

Subsample

Average

Bicubic

The method to use when downsampling. The default is bicubic for gray images.
ColorImageDownsamplingResolution0 to 32768The desired output resolution, in dpi. Pass 0 to leave images unchanged, which is the default.
ColorImageDownsamplingThreshold0 to 32768

The threshold above which images will be reduced to the desired resolution. Pass 0 to use the resolution.

ColorImageDownsamplingMethod

Subsample

Average

Bicubic

The method to use when downsampling. The default is bicubic for colour and grayscale images.

ColorImageCompression

Auto

Flate

DCT

LZW

RLE

Set the desired image compression for color images that need to be re-encoded. The default is eICAuto.

CCITT is not allowed for colour images.

Note: this is advisory only and may not be honoured in all cases.

GrayImageCompression

Auto

Flate

DCT

LZW

RLE

Set the desired image compression for gray images that need to be re-encoded. The default is Auto.

CCITT is not allowed for gray images.

Note: this is advisory only and may not be honored in all cases. For example, PDF/A does not allow LZW.

MonoImageCompression

Auto

CCITT

Flate

Set the desired image compression for monochrome images that need to be re-encoded. The default is CCITT.

JPEG/DCT is not allowed for mono images, and auto will be set to CCITT.

Note: this is advisory only and may not be honored in all cases. For example, PDF/A does not allow LZW.

UseMaskResolutionForMaskedImages

true

false

If true, the target resolution and threshold applied to the mask will also be applied to the image.

If false, then the mask and the image are evaluated separately and a downsampling resolution and threshold are chosen. This mode enables the image and mask to be downsampled to different resolutions.

The default is true.

Has no effect if downsampling is not enabled.

DownsampleMaskedImages

true

false

Sets whether to downsample masked images. The default is true.

This setting is ignored if downsampling is not enabled.

JPEGQuality1 to 5Sets the JPEG quality to use when compressing images in DCT format. The default is 3 - medium quality.

TargetColorSpace

DeviceRGB

DeviceGray

DeviceCMYK

By default, the target color space is used if anything must be rendered or color-converted. The default behavior is to apply this only when required. Use ConvertAllColors if converting everything is required.

For PDF/A-1b output, an OutputIntents dictionary will be created for this color space. LAB color spaces may not be used as a destination color space for PDF/A.

For PDF/X-1a output, only DeviceCMYK is supported; this setting is ignored.

TargetProfile

Path to ICC profile

Sets the target color space for the output using an ICC profile.

By default, the target color space is used if anything must be rendered or color-converted. The default behaviour is to apply this only when required. Use ConvertAllColors if converting everything is required.

ConvertAllColors

true

false

Sets whether all content should be color converted to the target space set by TargetProfile.

The default is false.

This parameter is ignored and assumed true when writing to PDF/A-1b or PDF/X-1a format output.

ConvertGray

true

false

Set whether gray colors should be subject to color conversion. That is, colors using DeviceGray, sGray, or single-component ICC colorspaces.

The default is true.

This parameter is ignored unless ConvertAllColors=true.

CompressPages

true

false

Set whether compression should be applied to page content. The default is true.

Note that if incremental output is used, the content of unedited pages is not affected.

Creating an uncompressed PDF will be significantly larger, but it can be viewed or edited in a text editor which is useful for debugging purposes.

EmbedBase14Fonts

true

false

Set whether the base 14 PDF fonts should be forcibly embedded. If true, this overrides the embedding settings in IDOMFontOpenType. Only the standard 14 fonts are not affected by this; use setEmbedFonts() to affect other fonts.

Note that if incremental output is used, the content of unedited pages is not affected.

The default is false. This setting is ignored for PDF/A and PDF/X where it is forced to true.

EmbedFonts

true

false

Set whether fonts should be forcibly embedded. If true, this overrides the embedding settings in each IDOMFont -

OpenType. The standard 14 fonts are not affected by this; use setEmbedBaseFonts() instead.

Note that if incremental output is used, the content of unedited pages is not affected.

The default is false. This setting is ignored for PDF/A and PDF/X where it is forced to true.

SubsetFonts

true

false

Set whether embedded fonts should be subset or not. The default is true.

This is a preference only. Some font types may require subsetting based on context.

Note that if incremental output is used, the content of unedited pages is not affected.

AlwaysEmbedfontlist

Provide a list of name of fonts that should be always embedded, regardless of the settings for setEmbedFonts() or

setEmbedBase14Fonts(). This setting is ignored for PDF/A.

Note that if incremental output is used, the content of unedited pages is not affected.

The fontlist is a string with the fonts delimited with semicolons (backslashes are used as an escape character).

Linearize

true

false

The default is false. When true, a PDF optimized for byte serving (for example from a web server) will be produced. This will generally be a slow operation.

AutoRotatePages

true

false

Set whether pages should be automatically rotated. The default is false.

Note that if incremental output is used, the content of unedited pages is not affected.

If true, pages are automatically rotated based on the prevalent text direction on the page. If incremental output is used, non-modified pages will not be subject to this setting.

The rotation is not a physical rotation of content, merely the PDF Page's view rotate is set appropriately.

setForceEmitPageGroup*

true

false

If an input PDF page contains a transparency page group, Mako does not emit a page group in an output PDF unless it detects that the page actually contains transparency. This default behavior is overridden by setting this to true. The default is false. As true is a safe setting in all circumstances, future versions of Mako may make this the default behavior.

* New in Mako 4.8.5


Presets are also available that apply several settings at once. These can be more convenient than setting several output parameters.

The downsampling options described here don't always produce the expected result. See Downsampling of masked images for further details.

  • No labels