DynaPDF.SetImportFlags2
-----------------------

Sets optional flags to control the import of external PDF files.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [4.3](newinversion43.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.SetImportFlags2"; PDF; Flags ) 

**MBS**( **"DynaPDF.SetImportFlags2";** /\* Sets optional flags to control the import of external PDF files. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Flags**) /\* The new import flags.  
Can be given as names or number.e.g. 16 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| Flags | The new import flags.   Can be given as names or number. | 16 |

### Result

Returns OK.

### Description

Sets optional flags to control the import of external PDF files.   
  
Flags to pass:  
| MergeLayers | 1 | If set, layers with identical name are merged. If this flag is absent DynaPDF imports such layers separately so that each layer refers still to the pages where it was originally used. |
|---|--:|---|
| Normalize | 2 | Replace LZW compression with Flate, apply limit checks, repair errors if possible |
| UseProxy | 4 | Not meaningful for PDF files which are loaded from a memory buffer. If set, all streams are loaded from the file on demand but they are never hold in memory. This reduces drastically the memory usage and enables the processing of almost arbitrary large PDF files with minimal memory usage. The corresponding PDF file must not be deleted before DynaPDF.CloseFile or DynaPDF.CloseFileEx was called. |
| NoMetadata | 8 | Ignore metadata streams which are attached to fonts, pages, images, and so on. |
| DuplicateCheck | 16 | Perform a duplicate check on color spaces, fonts, images, patterns, and templates when merging PDF files. |
| NoResNameCheck | 32 | Useful in viewer applications |
| CopyEncryptDict | 64 | If set, the encryption settings of an encrypted PDF file are copied to the new PDF file. The flag does nothing if the file is not encrypted. |
| SkipDPartData | 128 | If set, DPart dictionaries are not imported. |
| IncrementalUpd | 256 | This flag also sets the flags UseProxy, CopyEncryptDict, as well as ImportAsPage and ImportAll. |

See also [SetImportFlags2](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetImportFlags2.shtml) function in DynaPDF manual.

### Examples

Activate duplicate check to reduce file size:

 Set Variable \[$r ; Value: MBS ("DynaPDF.SetImportFlags2"; $pdf ; 16) \]  
Activate normalization, duplicate check and layer merge:

 Set Variable \[$r ; Value: MBS ( "DynaPDF.SetImportFlags2"; $pdf ; "MergeLayers¶Normalize¶DuplicateCheck" )\]  
Import and Export PDF:

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

 Set Variable \[$r ; Value: MBS ("DynaPDF.SetImportFlags2"; $pdf ; 4) \]  
Enable incremental updates:

 Set Variable \[$r ; Value: MBS ("DynaPDF.SetImportFlags2"; $pdf ; "IncrementalUpd")\]  
### See also

- [DynaPDF.GetAnnotFlags](DynaPDFGetAnnotFlags.md)
- [DynaPDF.GetImportFlags](DynaPDFGetImportFlags.md)
- [DynaPDF.GetImportFlags2](DynaPDFGetImportFlags2.md)
- [DynaPDF.ImportPDFFile](DynaPDFImportPDFFile.md)
- [DynaPDF.OpenPDFFromContainer](DynaPDFOpenPDFFromContainer.md)
- [DynaPDF.Release](DynaPDFRelease.md)
- [DynaPDF.Save](DynaPDFSave.md)
- [DynaPDF.SetAnnotFlagsEx](DynaPDFSetAnnotFlagsEx.md)
- [DynaPDF.SetImportFlags](DynaPDFSetImportFlags.md)
- [DynaPDF.SetUseGlobalImpFiles](DynaPDFSetUseGlobalImpFiles.md)

### Release notes

- **Version 13.4**
    - Added SkipDPartData option for [DynaPDF.SetImportFlags2](https://www.mbsplugins.eu/DynaPDFSetImportFlags2.shtml) function.

### Blog Entries

- [MBS FileMaker Plugin, version 13.4pr6](https://www.mbsplugins.de/archive/2023-09-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 6.1pr2](https://www.mbsplugins.de/archive/2016-02-10/MBS_FileMaker_Plugin_version_6/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 7th January 2026

  
[DynaPDF.SetImportFlags](DynaPDFSetImportFlags.md) - [DynaPDF.SetJPEGQuality](DynaPDFSetJPEGQuality.md)

[HTML Version](DynaPDFSetImportFlags2.shtml)