Set Parameters and Flags for PDF Export

Sergey Sorvenkov

February 23, 2023

The PDF export process can be managed with a set of parameters and flags that determine how the export should be executed. These parameters and flags are contained in a PDFExportParams class instance.

PDF export parameters are listed in the table below.

Export parameter name

Description

Get-method

Set-method

Database for export

A pointer to the database to be exported to a PDF file.

database()

setDatabase()

Output stream for writing to PDF file

A reference to an OdStreamBuff pointer, representing the output stream object to be used for writing data to a PDF file.

 

output()

setOutput()

Version

Version of the output PDF file. See the list of supported versions in the PDFExportVersions enumeration.

version()

setVersion()

Layouts to export

Array of the layouts that are exported to the output PDF file. If the array has no elements, only the active layout is exported. See Export Layouts and Set Page Parameters for PDF for more information.

layouts()

setLayouts()

Page parameters

Array of the page parameters (paper size, margins, etc.) of the exported layouts. The number of elements must be equal to the number of elements in the layout array. See Export Layouts and Set Page Parameters for PDF for more information.

pageParams()

setPageParams()

Background color

Background color of the output PDF file. White is the default value.

background()

setBackground()

Palette

Palette for the output PDF file. If not specified (NULL), one of two default palettes are used depending on the background color.

palette()

setPalette()

Color policy

Color policy used for creating export output. See Export to a Monochrome or a Grayscale PDF File for details.

colorPolicy()

setColorPolicy()

Vectorize resolution

Resolution used for vectorizing the output PDF file (in dots per inch, DPI). Standard values are: 72, 150, 200, 300, 400, 600, 720, 1200, 2400 and 4800 DPI. Default value is 600 DPI.

getGeomDPI()

setGeomDPI()

Hatch export resolution

Resolution for images created during hatch export (in dots per inch, DPI). See Export Hatches to PDF for details.

hatchDPI()

setHatchDPI()

Resolution for color and grayscale images

Resolution for exported color and grayscale images (in dots per inch, DPI).

colorImagesDPI()

setColorImagesDPI()

Resolution for monochrome images

Resolution for exported monochrome images (in dots per inch, DPI).

bwImagesDPI()

setBWImagesDPI()

Image cropping

Determines how clipped images are exported. An image can be clipped by a clipping boundary (for example, by the boundary of a page in a PDF file or by a viewport boundary). If equal to false, clipped images are exported as full images; in other case only the visible part of images are exported.

imageCropping()

setImageCropping()

Image DCT compression

Determines whether the Discrete Cosine Transformation (DCT) compression algorithm is used for exporting images. If the value is equal to true, images are represented in JPEG format. Using DCT compression significantly reduces the output PDF file size.

dctCompression()

setDCTCompression()

Image DCT compression quality

Determines the quality of image DCT compression (JPEG format) and is applied only if the Image DCT parameter is equal to true. The parameter value can be between 10 and 100 and determines the quality of the compressed image relative to the original image. The default value is 50.

dctQuality()

setDCTQuality()

Image upscaling

Determines whether images are upscaled if their resolution is lower than the set image resolution. By default, the parameter value equals false.

upscaleImages()

setUpscaleImages()

Solid hatch export type

Algorithm used for exporting solid hatches. See Export Hatches to PDF for details.

solidHatchesExportType()

setSolidHatchesExportType()

Gradient hatch export type

Algorithm used for exporting gradient hatches. See Export Hatches to PDF for details.

gradientHatchesExportType()

setGradientHatchesExportType()

Other hatch export type

Algorithm used for exporting non-solid and non-gradient hatches. See Export Hatches to PDF for details.

otherHatchesExportType()

setOtherHatchesExportType()

Output document's title

Title of the output PDF file.

title()

setTitle()

Output document's author

Name of the person who created the output PDF file.

author()

setAuthor()

Output document's subject

Subject of the output PDF file.

subject()

setSubject()

Output document's keywords

Keywords associated with the output PDF file.

keywords()

setKeywords()

Output document's creator

Name of the application (for example, Adobe® FrameMaker®) that was used to create the original drawing document.

creator()

setCreator()

Output document's producer

Name of the application (for example, Adobe Acrobat® Distiller) that was used to convert the original drawing to the output PDF file.

producer()

setProducer()

PDF/A support

Determines whether the output PDF file is created in the PDF/A (archive) format. See Export to PDF/A Format for more information.

archived()

setArchived()

PRC support

Determines how PRC format is supported during the export process. See Export to PDF using PRC for more information.

PRCMode()

setPRCMode()

PRC compression

Determines whether compression for PRC data is supported during the export process. You can separately set the compression level for both B-Rep and tessellation data. See Export to PDF using PRC for more information.

PRCCompression()

setPRCCompression()

PRC context

Contains the PRC data to export, which can be filtered to include specific entities to export to a PRC stream. See Export to PDF using PRC for more information.

getPRCContext()

setPRCContext()

PRC background color

Defines the background color of PRC data created as a result of the export operation. To determine whether the background color differs from the default color white, use the hasPrcBackground() method. To return the default background color for PRC data, call the clearPrcBackground() method. See Export to PDF using PRC for more information.

getPrcBackground()

setPrcBackground()

PRC rendering mode

Defines the rendering mode for the exported PRC content.

getPrcRenderingMode()

setPrcRenderingMode()

Shaded viewport export

Determines the export mode for viewports in shaded rendering mode. See Export Shaded Viewports to PDF for details.

shadedVpExportMode()

setShadedVpExportMode()

Transparency of shaded view background

Determines whether backgrounds of shaded views exported with a GS device are transparent. The true value indicates transparency; the false value indicates opaque.

transparentShadedVpBg()

setTransparentShadedVpBg()

Disable GS device

Disables the GS device that is used for exporting shaded views. If the parameter value is equal to true, the GS device is disabled; otherwise (by default) the GS device is enabled. ODA Software supports exporting to PDF as geometry for wireframe and wireframe with hidden lines (if the hidden lines removal algorithm is switched on). For other rendering modes (for example, shaded), the content is exported as an image, which is inserted into an output PDF file afterward. Although for particular circumstances, the drawing can have the same look for different rendering modes (for example, a circle for wireframe and shaded modes). In such cases, exporting a drawing as an image has a disadvantage when scaling the output PDF content. Therefore it is better to export such entities as geometry despite the rendering mode. To do it, switch off the GS device (set this option to true) and the drawing content is exported as geometry without dependency on the rendering mode. However, using this option can cause an incorrect rendering result in the output PDF document, so be careful. In general, it is not recommended to disable the GS device used for the export process.

forceDisableGsDevice()

setForceDisableGsDevice()

GSCache usage

Determines whether GsCache is used within a PDF export operation. For additional information, see Use GsCache during PDF Export.

useGsCache()

setUseGsCache()

Multi-threading for displaying and vectorization

Two parameters that define whether multi-threading is used for displaying and vectorization during the export process.

Note that it is necessary to switch the GsCache support option to use multi-threading.

isParallelDisplay()
isParallelVectorization()

setParallelDisplay()
setParallelVectorization()

PDF blocks

Determines whether blocks from an input drawing are exported as PDF blocks. For additional information, see Export Drawing Blocks as PDF Blocks.

isUsePdfBlocks()

setUsePdfBlocks()

Password Protection Support

Determines whether an exported PDF document is protected with a password.

Password protection support is available only for PDF versions 1.3 and higher.

For additional information, see Export to PDF with Password Protection.

ownerPassword()

userPassword()

accessPermissionFlags()

setOwnerPassword()

setUserPassword()

setAccessPermissionFlags()

Searchable text

Determines whether text from an original drawing can be searched in the output PDF file. See Export Searchable Text to PDF for more information.

searchableTextType()

setSearchableTextType()

Using view extents

Determines whether the export process should use view extents (if equal to true) or not (if equal to false). If this flag is set to true, the view extents are used instead of plot extents (which is used by default) when calculating the exported drawing extents. A drawing can contain entities that are considered in the calculation of the extents, but these entities are not rendered (for example, an empty multiline text entity, entities on hidden layers, etc.). View extents mode (flag is true) assumes that all invisible entities are taken into account when extents are calculated. Plot extents mode (flag is false) assumes that such entities are excluded from the extents calculations.

useViewExtents()

setUseViewExtents()

Watermarks

Contains an array of watermarks associated with the output PDF document. See Export to PDF using Watermarks for more information.

watermarks()

addWatermark()

Bookmarks

Determines whether bookmarks are created during the export. See Bookmarks Support Within the PDF Export for details.

bookmarksEnabled()

enableBookmarks()

Measuring type

Determines the type of measuring used during the export process. See Export Measurement Data to PDF for details.

measuringType()

setMeasuringType()

Ambient colors

Determines the ambient colors assigned to materials with textures during the export. See Determine Ambient Colors of Materials with Textures for PRC Export for details.

getPrcExportAmbientColorBehavior()

setPrcExportAmbientColorBehavior()

 

The PDF export flags are stored in the setExportFlags() enumerator, which is a member of the PDFExportParams class. PDF export options are determined by the parameters' values and combination of parameter flags.

The default combination of export flags is


kTTFTextAsGeometry|kSHXTextAsGeometry|kFlateCompression|kASCIIHexEncoding|kZoomToExtentsMode

, i.e.:

 

  • TrueType text as geometry flag is switched on.
  • SHX text as geometry flag is switched on.
  • Data compression flag is switched on.
  • Hexadecimal encoding flag is switched on.
  • Zoom to extents mode is switched on.
  • Other flags are switched off.

Some export flags are not recommended for use because they are deprecated or can be removed or changed in future versions of the ODA Platform. See Deprecated Export Flags for details.

PDF export flags are described in the following table.

Export parameter

Parameter name

Value

Description

Use embedded TTF

kEmbededTTF

1

Enable embedding of TrueType font files in the PDF file. See Export Fonts to PDF for more information.

TTF text as geometry

kTTFTextAsGeometry

2

Enable TrueType font text to geometry conversion. See Export Fonts to PDF for more information.

SHX text as geometry

kSHXTextAsGeometry

4

Enable SHX font text to geometry conversion. See Export Fonts to PDF for more information.

Use geometry optimization

kSimpleGeomOptimization

8

Determines whether simple geometry optimization is enabled during the export process (separated segments combined to one polyline, Bezier curve control points). Simple geometry optimization uses a more effective mechanism of drawing document elements (drawing one polyline instead of several separated segments, Bezier curve control points, and so on). For example, if optimization is not used, a rectangle is drawn with four commands: one for each line. When optimization is used, a rectangle is drawn with a single command, reducing the overall size of the output file.

Enable layer support

kEnableLayers

16

Determines whether layer support is enabled, in which case layers are added to the output PDF file. See PDF Export: Layers for more information.

Include invisible layers

kIncludeOffLayers

32

Determines whether invisible layers of the exported drawing are added to the output PDF file. See Export Layers to PDF for more information.

Embedded TTF optimization

kEmbededOptimizedTTF

64

Enables reducing the TrueType font file size that is embedded in the output PDF file. See Export Fonts to PDF for more information.

Use hidden lines removal algorithm

kUseHLR

128

Determines whether software vector hidden-line removal (HLR) is used to delete hidden lines during the export process for corresponding viewports. If this flag is equal to true, the drawing contents in wireframe mode is exported as geometry. If false, the content is exported as an image.

Data compression

kFlateCompression

256

Determines whether a data compression algorithm is applied when writing drawing data in the internal PDF stream. If the flag is on, the internal PDF compression algorithm is used. Data compression reduces the size of the output PDF file.

Hexadecimal encoding

kASCIIHexEncoding

512

Determines whether data is written in the internal PDF stream as hexadecimal format, which allows you to explore the output file with hex-editors. For hexadecimal support, switch on the Hexadecimal Encoding parameter. Remember that using hexadecimal support leads to doubling of the output file size.

Exporting hyper links support

kExportHyperlinks

1024

Enables exporting hyperlinks to the output PDF file.

Zoom to extents mode

kZoomToExtentsMode

2048

Determines whether the exported drawing is in the Zoom to Extents mode. If enabled, the layout geometry is zoomed to the paper size, otherwise layout settings are applied.

Create a linearized PDF file

kLinearized

4096

Determines whether the export process creates a linearized PDF file from the exported drawing. See Export to a Linearized PDF File for more information.

Merge crossing lines colors

kMergeLines

8192

Determines whether the colors of crossing lines are merged.

Measuring scale

kMeasuring

16384

Determines whether the measuring scale is implemented for the entities in the output PDF file. See Export Measurement Data to PDF for more information.

Special values of flags can also be used:

  • kZeroFlag(0) means that all flags are disabled.
  • kDefault stores the default value of the flag combination.

To get the current combination of export flags, use the exportFlags() method of the PDFExportParams class.

To set a new combination of export flags as the current one, use the setExportFlags() method of the PDFExportParams class.

Deprecated Export Flags

Do not use the m_reserved1, m_reserved2, m_reserved3, or m_reserved4 flags because they are deprecated and can be changed or deleted in future versions of ODA Platform.

To get more information please refer to ODA Documentation.