Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old


The function sets optional flags to control the import of external PDF files.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 4.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.SetImportFlags"; PDF; Flags )   More


Parameter Description Example
PDF The PDF reference returned from DynaPDF.New. $pdf
Flags The new flags value. 268435454


Returns OK or error.


The function sets optional flags to control the import of external PDF files.
By default the plugin uses ifImportAll combined with ifImportAsPage.

Flag Description
ImportAll268435454If set, all objects of an external PDF file are imported.
ContentOnly0If set, interactive objects such as annotations, bookmarks or form fields are excluded from import.
NoContent1If set, the visual contents of external pages will not be imported. This flag can be used to copy interactive objects from one file into another, such as interactive form fields.
ImportAsPage2147483648If set, pages are not converted to templates. This flag is useful if an imported page must not be used multiple times. Conversion to templates is recommended if multiple imported pages should appear on the same page; such overlapping pages can cause resource conflicts which produces unpredictable output.
CatalogAction2If set, catalog actions will be imported if any. The documents catalog is the root object of a PDF file, which can trigger actions when the file will be opened, closed, or printed. See AddActionToObj() for further information.
PageActions4If set, page actions are imported if any. A page action is an action that was added to the page itself, not an object of a page.
Bookmarks8If set, bookmarks are imported if any.
Articles16If set, Articles are imported if any.
PageLabels32If set, page labels are imported if any. If multiple files are imported, DynaPDF imports the page labels of the first file only.
Thumbs64If set, thumb nail images are imported if any. Thumb nails can be dynamically created by Acrobat since Acrobat 5. The thumb nail images can be removed to reduce disk space.
TranspGroups128If set, transparency groups are imported if any. If transparency groups are removed the objects appear then opaque.
SeparationInfo256If set, the separation information dictionary will be imported if any.
BoxColorInfo512If set, the bounding boxes artbox, bleedbox and trimbox are shown in user defined color. Note that the cropbox represents the current page; the page is already cropped if a cropbox was defined.
StructureTree1024If set, structure trees are imported if any. A structure tree contains information about the logical structure of a document. This information can be used by screen readers and other accessibility plug-ins to enable certain features. The information of a structure tree is not required to view or print a PDF document.
Transition2048If set, transition settings are import. A transition dictionary contains information about how a presentation should be displayed. These settings can be removed if the document should not be used in presentation mode.
SearchIndex4096If set, the file path to an external search index will be imported if any.
JavaScript8192If set, global JavaScripts are imported if any. Note that JavaScript actions can use the functions defined in global JavaScripts. If these scripts are removed, JavaScript actions must normally also removed to avoid errors. However, it is often useful to remove the scripts for certain debug operations.
JSActions16384If set, JavaScript actions are imported if any. This flag is useful if an imported form contains JavaScripts which produces errors or warnings. For instance, a document can define certain scripts which may require specific settings such as a document info string and so on. It is then often difficult to determine which object produces the error or warning because it can be a JavaScript action or a global JavaScript. In such cases, JavaScript actions can be excluded temporarily to check whether the error still occurs.
DocInfo32768If set, document info entries are imported if any. Already existing entries are not overridden.
EmbeddedFiles2097152If set, embedded files are imported.
FileCollections4194304If set, the global definition of a collection is imported. The file attachments are still imported if the flag ifEmbeddedFiles is set. The PDF file is simply not longer marked as portable collection, also known as PDF Package. See also DynaPDF.CreateCollection.
AllAnnots10420224If set, all types of annotations are imported.
FreeText65536This flag is meaningful only if the flag ifAllAnnots is clear. If set, FreeText annotations are imported if any.
TextAnnot131072This flag is meaningful only if the flag ifAllAnnots is clear. If set, text annotations are imported if any.
Link262144This flag is meaningful only if the flag ifAllAnnots is clear. If set, link annotations are imported if any. This annotation type is used for weblinks, page links, and file links.
Stamp524288This flag is meaningful only if the flag ifAllAnnots is clear. If set, stamp annotations are imported if any.
3DAnnot1048576This flag is meaningful only if the flag ifAllAnnots is clear. If set, 3D annotations are imported if any.
OtherAnnots8388608This flag is meaningful only if the flag ifAllAnnots is clear. If set, other annotation types as the ones listed above are imported if any.
FormFields16777216If set, interactive form fields are imported if any (also called AcroForm). Form fields are also annotations, but this type is handled separately.
PrepareForPDFA268435456If set, LZW compressed streams are recompressed with Flate, the Interpolate key of images is deleted if set, embedded files are not imported.
EnumFonts536870912If set, only font objects are imported to enable high performance enumeration of the fonts used in a PDF file. The PDF file must be deleted with FreePDF() after the fonts were enumerated. See DynaPDF.EnumDocFonts for further information.
AllPageObjects1073741824If set, all types of link annotations are imported when importing a page within an open page with ImportPageEx(). The entire document should be imported in this case.

See also SetImportFlags function in DynaPDF manual.


Set import flags:

MBS( "DynaPDF.SetImportFlags"; $PDF; 268435454 + 2147483648 )

Set import flags with names:

MBS( "DynaPDF.SetImportFlags"; $pdf; "ImportAll¶ImportAsPage¶PrepareForPDFA" )

Import and Export PDF:

# Start new PDF
Set Variable [$pdf; Value:MBS("DynaPDF.New")]
# set import flags
Set Variable [$r; Value:MBS( "DynaPDF.SetImportFlags"; $pdf; "ImportAll ImportAsPage PrepareForPDFA" )]
Set Variable [$r; Value:MBS( "DynaPDF.SetImportFlags2"; $pdf; "DuplicateCheck" )]
# Import PDF from container
Set Variable [$r; Value:MBS("DynaPDF.OpenPDFFromContainer"; $pdf; MyTable::InputPDF)]
Set Variable [$r; Value:MBS("DynaPDF.ImportPDFFile"; $pdf; 1)]
# Save back
Set Field [MyTable::OutputPDF; MBS("DynaPDF.Save"; $pdf; "Merged.pdf")]
Set Variable [$r; Value:MBS("DynaPDF.Release"; $pdf)]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 27th May 2017

DynaPDF.SetGStateFlags - DynaPDF.SetImportFlags2