TrophyCustomer's Canvas is honored with a 2020 InterTech Technology Award! Learn more 

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, you have learned that preflight configuration includes the rules array defining the preflight rules. Now, let's see what rules you can use.

JSON
{
    "params": {
        "config": {
            "rules": [
                {
                    "type": "colorspace",
                    "severity": "error",
                    "enableFix": true,
                    "params": {
                        "allowedColorSpaces": ["GRAYSCALE", "CMYK"],
                        "fixTarget": "CMYK"
                    }
                },
                {
                    "type": "spotcolors",
                    "severity": "error",
                    "params": {
                        "allowed": {
                            "names": ["PANTONE 653 C", "PANTONE 649 C"],
                            "regexps": ["/.*2405.*/g", "/.*Green.*/g"]
                        } 
                    }
                },
                {
                    "type": "resolution",
                    "severity": "warning",
                    "params": {
                        "target": 300
                    }
                },
                {
                    "type": "safetyboxes",
                    "severity": "error",
                    "params": {
                        "require": ["bleed", "crop", "trim"]
                    }
                },
                {
                    "type": "nomargins",
                    "severity": "warning",
                    "enableFix": true
                },
                {
                    "type": "insideBleedbox",
                    "severity": "warning",
                    "enableFix": true
                },
                {
                    "type": "sameorientation",
                    "severity": "warning",
                    "enableFix": true
                },
                {
                    "type": "forbiddenfonts",
                    "severity": "error",
                    "params": {
                        "fonts": ["Roboto-Regular"]
                    }
                },
                {
                    "type": "allowedfonts",
                    "severity": "warning",
                    "params": {
                        "fonts": ["Calibri", "LucidaSans"]
                    }
                },
                {
                    "type": "fonttypes",
                    "severity": "error",
                    "params": {
                        "allowedFontTypes": ["TrueType"]
                    }
                },
                {
                    "type": "minfontsize",
                    "severity": "error",
                    "params": {
                        "black": 8,
                        "colored": 8
                    }
                },
                {
                    "type": "textascurves",
                    "severity": "warning"
                },
                {
                    "type": "embeddedfonts",
                    "severity": "warning"
                }
            ]
        }
    }
}

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", "spotcolors", "resolution", "safetyboxes", "nomargins", "insideBleedbox", "sameorientation", "forbiddenfonts", "allowedfonts", "fonttypes", "minfontsize", "textascurves", "embeddedfonts"
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", "nomargins", "insideBleedbox", and "sameorientation". 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[]

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.

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) or a Photoshop plugin (like 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.

See Also

Manual