---
title: "Preflight rules | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/preflight/reference/rules/"
---

# Preflight rules

> This topic describes how you can define rules to validate user files. The Preflight Tool allows you to check the used colors, text properties, resolution of graphics, page orientation, and PDF page boxes in the uploaded files.

In the [previous topic](https://customerscanvas.com/docs/on-premises/preflight/reference/config.md), you have learned that preflight configuration includes the `rules` array defining the preflight rules. Now, let's see what rules you can use.

<pre><code>{`{
    "params": {
        "config": {
            "rules": [
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#color-spaces">colorspace</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "error",
                    "`}<a href="#enableFix" title="Enables the Fix button.">enableFix</a>{`": true,
                    "params": {
                        "`}<a href="#allowedColorSpaces" title="Color spaces valid for your printing equipment.">allowedColorSpaces</a>{`": ["GRAYSCALE", "CMYK"],
                        "`}<a href="#fixTarget" title="A target color space.">fixTarget</a>{`": "CMYK"
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#spot-colors">spotcolors</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "error",
                    "`}<a href="#enableFix" title="Enables the Fix button.">enableFix</a>{`": true,
                    "params": {
                        "`}<a href="#allowedSpotColors" title="Spot colors valid for your printing equipment.">allowed</a>{`": {
                            "`}<a href="#spotColorNames" title="Names of valid spot color.">names</a>{`": ["PANTONE 653 C", "PANTONE 649 C"],
                            "`}<a href="#spotColorRegexp" title="Regexps of valid spot color.">regexps</a>{`": ["/.*2405.*/g", "/.*Green.*/g"]
                        },
                        "`}<a href="#fixTarget" title="A target color space.">fixTarget</a>{`": "CMYK"
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#required-spot-colors">spotrequiredcolors</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning",
                    "params": {
                        "`}<a href="#requiredSpotColors" title="Spot colors valid for your printing equipment.">required</a>{`": {
                            "`}<a href="#requiredSpotColorNames" title="Names of the required colors.">names</a>{`": ["PANTONE 653 C", "PANTONE 649 C"],
                            "`}<a href="#requiredSpotColorRegexp" title="Regexps of required colors.">regexps</a>{`": ["/.*2405.*/g", "/.*Green.*/g"]
                        }
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#resolution">resolution</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning",
                    "params": {
                        "`}<a href="#target" title="An allowed DPI value.">target</a>{`": 300
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#defined-boxes">safetyboxes</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "error",
                    "params": {
                        "`}<a href="#requiredBoxes" title="Required PDF page boxes.">require</a>{`": ["bleed", "crop", "trim"]
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#trim-box">nomargins</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning",
                    "`}<a href="#enableFix" title="Enables the Fix button.">enableFix</a>{`": true
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#bleed-box">insideBleedbox</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning",
                    "`}<a href="#enableFix" title="Enables the Fix button.">enableFix</a>{`": true
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#bleed-box-margins">nomarginsBleedbox</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning",
                    "`}<a href="#enableFix" title="Enables the Fix button.">enableFix</a>{`": true
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#page-orientation">sameorientation</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning",
                    "`}<a href="#enableFix" title="Enables the Fix button.">enableFix</a>{`": true
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#forbidden-fonts">forbiddenfonts</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "error",
                    "params": {
                        "`}<a href="#forbiddenfontsArray" title="An array of PostScript names.">fonts</a>{`": ["Roboto-Regular"]
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#allowed-fonts">allowedfonts</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning",
                    "params": {
                        "`}<a href="#allowedfontsArray" title="An array of PostScript names.">fonts</a>{`": ["Calibri", "LucidaSans"]
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#font-types">fonttypes</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "error",
                    "params": {
                        "`}<a href="#allowedFontTypes" title="An array of PostScript names.">allowedFontTypes</a>{`": ["TrueType"]
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#font-size">minfontsize</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "error",
                    "params": {
                        "`}<a href="#minfontsizeblack" title="The min font size of black text.">black</a>{`": 8,
                        "`}<a href="#minfontsizecolored" title="The min font size of colored text.">colored</a>{`": 8
                    }
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#vector-text">textascurves</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning"
                },
                \{
                    "`}<a href="#type" title="The type of the preflight rule.">type</a>{`": "`}<a href="#embedded-fonts">embeddedfonts</a>{`",
                    "`}<a href="#severity" title="The severity of the preflight rule.">severity</a>{`": "warning"
                }
            ]
        }
    }
}`}</code></pre>

These rules have the following common properties: `type`, `severity`, and `enableFix`. In the `params` object, you can set up parameters specific to the rule type, if any.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| type | The type of the preflight rule. | ["colorspace"](#color-spaces), ["spotcolors"](#spot-colors), ["spotrequiredcolors"](#required-spot-colors), ["resolution"](#resolution), ["safetyboxes"](#defined-boxes), ["nomargins"](#trim-box), ["insideBleedbox"](#bleed-box), ["nomarginsBleedbox"](#bleed-box-margins), ["sameorientation"](#page-orientation), ["forbiddenfonts"](#forbidden-fonts), ["allowedfonts"](#allowed-fonts), ["fonttypes"](#font-types), ["minfontsize"](#font-size), ["textascurves"](#vector-text), ["embeddedfonts"](#embedded-fonts) |
| severity | The severity of the preflight rule. This value allows you to visualize and process validation problems in different ways. Warnings can be ignored when rendering the resulting print files, whereas errors prevent the final rendering and must be fixed, either manually or automatically. | `"error"`, `"warning"` |
| enableFix | Enables the **Fix** button only if the Preflight Tool supports an automatic correction of the validation problem. In the current implementation, this tool automatically fixes the following problems: ["colorspace"](#color-spaces), ["nomargins"](#trim-box), ["insideBleedbox"](#bleed-box), ["nomarginsBleedbox"](#bleed-box-margins), ["sameorientation"](#page-orientation), and ["spotcolors"](#spot-colors). The default value is `false`. | boolean |

## The Color Check

### Color Spaces

In the `colorspace` rule, you can check if user files use only the allowed color spaces.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| allowedColorSpaces | An array of color spaces valid for your printing equipment. In this array, you can specify `"RGB"`, `"CMYK"`, and `"GRAYSCALE"`. | string[] |
| fixTarget | A target color space for fixing an invalid color space. By default, the Preflight Tool uses the first value of the `allowedColorSpaces` array to fix color spaces. | string |

### Spot Colors

The `spotcolors` rule allows you to check if the user file uses only the specified spot colors. To specify spot colors, you can both list their names and use regular expressions.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| allowed | An object defining valid spot colors. | object |
| names | An array of names of spot colors valid for your printing equipment. For example, `["PANTONE 653 C", "PANTONE 649 C"]`. | string[] |
| regexps | An array of regular expressions for names of spot colors valid for your printing equipment. For example, `["/.*2405.*/g", "/.*Green.*/g"]`. | string[] |
| fixTarget | A target color space for converting an invalid spot color. The default value is `"CMYK"`. | string |

### Required Spot Colors

The `spotrequiredcolors` rule allows you to check if the user file uses the specified colors. Unlike the `spotcolors` rule, which lists the allowed colors, this rule requires applying one or more colors to the elements in the uploaded file. To specify spot colors, you can both list their names and use regular expressions.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| required | An object defining colors that must be applied to at least one design element. | object |
| names | An array of names of spot colors valid for your printing equipment. For example, `["PANTONE 653 C", "PANTONE 649 C"]`. | string[] |
| regexps | An array of regular expressions for names of spot colors valid for your printing equipment. For example, `["/.*2405.*/g", "/.*Green.*/g"]`. | string[] |

## Resolution

This rule allows you to verify that the resolution of graphics in the user file is equal to or greater than the `target` value.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| target | An allowed DPI value. | number |

## PDF Page Boxes

### Defined boxes

The `safetyboxes` rule allows you to check if `BleedBox`, `CropBox`, and `TrimBox` are defined in PDF files.

In `params`, you must define the `require` parameter. Since this rule doesn't have an auto fix, you cannot enable the **Fix** button.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| require | PDF page boxes required for your printing equipment. In this array, you can specify the `"bleed"`, `"crop"`, and `"trim"` values to verify if the corresponding page boxes are defined in the user's PDF files. | string[] |

### Trim Box

You can use the `nomargins` rule to ensure the user's file fills the entire trim box.

This rule does not require additional `params`.

### Bleed Box

You can use the `insideBleedbox` rule to ensure the user's file fits the bleed box.

This rule does not require additional `params`.

### Bleed Box Margins

You can use the `nomarginsBleedbox` rule to ensure the user's file fills the entire bleed box, and there are no blank margins left.

This rule does not require additional `params`.

## Page Orientation

The Preflight Tool helps you maintain the same orientation of pages in a document. The `sameorientation` rule checks if all pages in the document have the same orientation.

The **Fix** button rotates images on pages that have an _incorrect_ orientation. As the _correct_ orientation, this tool takes the orientation of the majority of the pages. When the user's file has the same number of landscape and portrait pages, the orientation of the front page will be applied to all pages.

This rule does not require additional `params`.

## Text

:::note
To get PostScript names, you can open your fonts with a font editor (for example, [FontForge](https://fontforge.github.io/)) or a Photoshop plugin (like [Get Font PostScript Name](https://github.com/tonton-pixel/JSON-Photoshop-Scripting/tree/master/Utility-Scripts/Get-Font-PostScript-Name)).
:::

### Forbidden fonts

The forbiddenfonts rule allows you to check if the specified fonts are not used in PDF files. In params, you can define the fonts array of PostScript names.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| fonts | An array of PostScript font names, for example, `["Calibri", "LucidaSans"]`. | string[] |

### Allowed fonts

The `allowedfonts` rule allows you to check if only the specified fonts are used in PDF files. In `params`, you can define the `fonts` array of PostScript names.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| fonts | An array of PostScript font names. | string[] |

### Font types

The `fonttypes` rule allows you to check font types in PDF files. In `params`, you can define an array of the allowed font types, for example, `["TrueType","OpenType","Type 1","Type 3","MMType1"]`.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| allowedFontTypes | An array of font types that can be used in PDF files, for example, `["TrueType"]`. | string[] |

### Font size

The `minfontsize` rule allows you to check if the text in PDF files is readable. In `params`, you can specify different values for plain black text and colored text.

| Name | Description | Possible values |
| :--- | :--- | :--- |
| black | The min allowed font size of black text, in points. | number |
| colored | The min allowed font size of colored text, in points. | number |

### Vector text

When you want text in print files to look exactly the same as in design templates, you would prefer that the PDF files contain text converted to vector shapes. You can use the `textascurves` rule to ensure that text represents vector shapes in the uploaded PDF files.

This rule does not require additional `params`.

### Embedded fonts

You can use the `embeddedfonts` rule to ensure that the user's PDF file contains all the necessary fonts along with text.

This rule does not require additional `params`.
