DynaPDF.SetGStateFlags
----------------------

Sets optional flags affecting the graphics state, coordinate handling, as well as color and image conversion rules.

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

MBS( "DynaPDF.SetGStateFlags"; PDF; Value { ; Reset } ) 

**MBS**( **"DynaPDF.SetGStateFlags";** /\* Sets optional flags affecting the graphics state, coordinate handling, as well as color and image conversion rules. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Value**; /\* The new value. Can be a number or a list including one or more of the following words: Compatible, RestorePageCoords, RealTopDownCoords, NativeBlackWhite, UseImageColorSpace, IgnoreICCProfiles, AnsiStringIsUTF8, RealPassThrough, NoBitmapAlpha or NoImageDuplCheck.e.g. 3 \*/   
**$Reset**) /\* Optional; If the parameter Reset is true, the new flags replace current flags. If set to false, the flags are combined with the current flags.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |  |
| Value | The new value. Can be a number or a list including one or more of the following words: Compatible, RestorePageCoords, RealTopDownCoords, NativeBlackWhite, UseImageColorSpace, IgnoreICCProfiles, AnsiStringIsUTF8, RealPassThrough, NoBitmapAlpha or NoImageDuplCheck. | 3 |  |
| Reset | If the parameter Reset is true, the new flags replace current flags. If set to false, the flags are combined with the current flags. | 0 | Optional |

### Result

Returns OK or error.

### Description

Sets optional flags affecting the graphics state, coordinate handling, as well as color and image conversion rules.   
If the parameter Reset is true, the new flags replace current flags. If set to false, the flags are combined with the current flags.   
| Flag | Description |
|---|---|
| RestorePageCoords | If set, the current base coordinate system like bottom or top down is saved and restored with the graphics state. |
| RealTopDownCoords | This flag is reserved for future extensions. It is not implemented yet. |
| NativeBlackWhite | If set, RGB black or white is not converted to DeviceGray. This flag affects text and vector graphics but no images. |
| UseImageColorSpace | If set, the active color space is ignored when inserting an image. The color space is taken from the image file instead. See also "Color spaces and Images" in DynaPDF help file. |
| IgnoreICCProfiles | If set, embedded ICC profiles in image files are ignored when inserting an image. The image is inserted in the base color space instead. This flag is not meaningful if the flag gfUseImageColorSpace is absent. See also "Color spaces and Images" in DynaPDF help file. |
| AnsiStringIsUTF8 | If set, all Ansi functions interpret string parameters as UTF-8 encoded Unicode strings. Should not be used with MBS Plugin. |
| RealPassThrough | If set, JPEG images are inserted as is. JPEG images are normally rebuild, also in pass-through mode, to avoid issues with certain malformed JPEG images which cannot be displayed in Adobes Acrobat or Reader. If you know that your JPEG images work then set this flag to avoid unnecessary processing time. |
| NoBitmapAlpha | If set, the alpha channel in bitmaps files will be ignored. This is sometimes useful since many 32 bit bitmaps contain an invalid alpha channel that makes the image fully transparent. |
| NoImageDuplCheck | If set, no duplicate check for images will be performed. This can significantly improve processing speeed especially for memory based images. |
| NoObjCompression | If set, object compression will be disabled. |
| ComplexText | If set, text is processed with Uniscribe on Windows. |
| DisableJavascript | If set, the raw field value of text fields is used to create the apprearance stream. |
| DisableBidiCtrls | Meaningful only if gfComplexText is set too. If set, bidi control characters are ignored. This flag can be useful if the result of web browsers should be emulated since web browsers do not support bidi control characters. This flag is also used internally to create the appearance stream of form fields since form fields do not support bidi control characters. |
| DoNotComprMetadata | If set, arbitrary metadata stream associated with PDF objects other that the global metadata stream will not be compressed. This can be useful since certain standards prohibit compression of metadata streams. The flag is automatically for PDF/X files. |

  
In DynaPDF 5 the UseImageColorSpace flag is on by default. Was off in DynaPDF 4.  
See also [SetGStateFlags](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetGStateFlags.shtml) function in DynaPDF manual.

### Examples

Set two options:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "RealPassThrough, UseImageColorSpace" )\]  
Restore page coords setting with RestoreState call:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "RestorePageCoords" ) \]  
Have RGB black or white to be not converted to DeviceGray:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "NativeBlackWhite" ) \]  
Ask DynaPDF to ignore the active color space and use image color space:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "UseImageColorSpace" ) \]  
Ignore embedded ICC profiles in image files are ignored when inserting an image:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "IgnoreICCProfiles" ) \]  
Insert JPEG images are inserted as is:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "RealPassThrough" ) \]  
Ignore the alpha channel in bitmaps files:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "NoBitmapAlpha" ) \]  
Ask not to do duplicate check for images:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "NoImageDuplCheck" ) \]  
Enable complex text layout:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "ComplexText" ) \]  
Disable object compression:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "NoObjCompression" ) \]  
Disable Javascript actions:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "DisableJavascript" ) \]  
Ignore bidi control characters for complex layouts:

 Set Variable \[ $r ; Value: MBS ( "DynaPDF.SetGStateFlags"; $pdf ; "DisableBidiCtrls" ) \]  
Disable compression for metadata:

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

- [DynaPDF.ActivateAltFontList](DynaPDFActivateAltFontList.md)
- [DynaPDF.CreateAltFontList](DynaPDFCreateAltFontList.md)
- [DynaPDF.GetAnnotFlags](DynaPDFGetAnnotFlags.md)
- [DynaPDF.GetGStateFlags](DynaPDFGetGStateFlags.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetAltFonts](DynaPDFSetAltFonts.md)
- [DynaPDF.SetAnnotFlags](DynaPDFSetAnnotFlags.md)
- [DynaPDF.SetColorSpace](DynaPDFSetColorSpace.md)
- [DynaPDF.SetFieldFlags](DynaPDFSetFieldFlags.md)
- [DynaPDF.SetImportFlags](DynaPDFSetImportFlags.md)

### Release notes

- **Version 15.1**
    - Added RoundHighlightAP flag to [DynaPDF.SetGStateFlags](https://www.mbsplugins.eu/DynaPDFSetGStateFlags.shtml) function.
- **Version 13.5**
    - Added SkaleAnnotIcons flag for [DynaPDF.SetGStateFlags](https://www.mbsplugins.eu/DynaPDFSetGStateFlags.shtml) function.
- **Version 12.4**
    - Added DoNotComprMetadata flag for [DynaPDF.SetGStateFlags](https://www.mbsplugins.eu/DynaPDFSetGStateFlags.shtml) function.

### Example Databases

- [DynaPDF/Place Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Place%20Picture.shtml#1ScriptAnchor_)
- [DynaPDF/WriteFText](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/WriteFText.shtml#4ScriptAnchor_)

### Blog Entries

- [Use complex text rendering with DynaPDF in FileMaker](https://www.mbsplugins.de/archive/2025-06-25/Use_complex_text_rendering_wit/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 15.1pr6](https://www.mbsplugins.de/archive/2025-03-03/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 13.5 for Claris FileMaker](https://www.mbsplugins.de/archive/2023-11-07/MBS_Plugin_135_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 13.5pr1](https://www.mbsplugins.de/archive/2023-09-26/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [DynaPDF graphics flags](https://www.mbsplugins.de/archive/2023-08-02/DynaPDF_graphics_flags/monkeybreadsoftware_blog_filemaker)
- [Top 10 from the MBS Plugin in 2022](https://www.mbsplugins.de/archive/2022-12-29/Top_10_from_the_MBS_Plugin_in_/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 12.4 for Claris FileMaker](https://www.mbsplugins.de/archive/2022-09-06/MBS_Plugin_124_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 12.4pr5](https://www.mbsplugins.de/archive/2022-09-02/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [New in MBS FileMaker Plugin 12.0](https://www.mbsplugins.de/archive/2022-01-31/New_in_MBS_FileMaker_Plugin_12/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 5.3pr1](https://www.mbsplugins.de/archive/2015-08-26/MBS_FileMaker_Plugin_version_5/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 21st August 2015 , last changed 14th February 2026

  
[DynaPDF.SetFontWeight](DynaPDFSetFontWeight.md) - [DynaPDF.SetImportFlags](DynaPDFSetImportFlags.md)

[HTML Version](DynaPDFSetGStateFlags.shtml)