Defining preflight rules
- 2-3 minutes to read
To enable a preflight check, you need to define the config.rules array. This array contains as many elements as the rules that must be checked.
How to set up preflight rules
For example, you may want to adjust the color space and resolution of products. In this case, you must define two elements in the rules array.
{
"widgets": [{
"name": "preflight",
"type": "preflight",
"params": {
"config": {
"rules": [
{
"type": "colorspace",
"severity": "error",
"enableFix": true,
"params": {
"allowedColorSpaces": ["CMYK"]
}
},
{
"type": "resolution",
"severity": "warning",
"params": {
"target": 300
}
}
]
}
}
}]
}
Here, severity specifies whether a preflight problem can remain in the print file or if it must be fixed.
As a result, if user files contain graphics in color spaces other from CMYK, then the Preflight Tool considers them invalid and enables the Fix button to resolve this issue automatically. If these files have a resolution of less than 300 DPI, then a warning only appears in the editor.
How to specify spot colors
You can define a set of allowed spot colors in a rule of the spotcolors type. In the allowed object, you can list spot color names and use regular expressions. Other spot colors will be considered invalid, and the Preflight Tool will suggest to replace them.
{
"widgets": [{
"name": "preflight",
"type": "preflight",
"params": {
"config": {
"rules": [{
"type": "spotcolors",
"severity": "error",
"params": {
"allowed": {
"names": [ "PANTONE 653 C", "PANTONE 649 C", "PANTONE 7677 C" ]
}
}
}]
}
}
}]
}
How to define rules for certain pages
You can configure preflight rules so that they apply to certain pages. For example, to apply a rule to all even pages:
{
"widgets": [{
"name": "preflight",
"type": "preflight",
"params": {
"config": {
"rules": [
{
"type": "colorspace",
"severity": "error",
"enableFix": true,
"pages": ["/2"],
"params": {
"allowedColorSpaces": ["CMYK"]
}
}
]
}
}
}]
}
Here, we have defined pages
as an array of strings with the element "/2"
, which applies the rule to every second page. To apply the rule to every third page, pass "/3"
, and so on.
You can also list page numbers in the pages
array to apply rules to the corresponding pages. For example, to apply them to the second and fourth pages:
...
"pages": [2, 4],
...
How to configure the Fix All button
You may want to configure a single button to fix several or even all preflight problems in one click. Let's see how you can configure the Fix All button to resolve errors and warnings from the rules with the enableFix
property set to true
.
{
...
"interface": {
"customButtons": [
{
"title": "Fix All",
"filter": {
"severity": ["error", "warning"]
}
}
]
}
}
Here, we only specified the severity
of the rules. Instead, you can list the required rules in the types array.
The Preflight Tool also allows you to change the button appearance. For details, you can refer to Configuring the user interface.