Skip to main content

Config reference

In the distribution package, you can find the config.json file. This file configures both the multistep editor (not covered in this topic) and the Preflight Tool widget. In this file, you must define such properties as the URL of the server component, preflight rules, and front-end parameters.

note

You can load this configuration from an external file (as in the provided sample), define it as a variable in JavaScript code, or even read it from your database.

Front-end parameters allow you to set up the workflow and appearance of this tool. Now, let's see how you can configure the preflight widget. The following example represents the params.config object and shows how you can specify a 720 x 576 pt product with 300 dpi, configure the bleed zone, set a preflight rule to check the color space, enable a button to upload the users' files, and more.

{
  "language": "en",
  "backendUrl": "https://example.com",
  "startFromUploader": true,
  "mode": {
      "ignoreServerErrors": true,
      "requestTimeout": 20
  },
  "uploader": {
      "fileTypes": [".pdf", ".jpg", ".jpeg"],
      "multiple": true,
      "initialMode": "default",
      "fileUploadBehavior": "insertCurrent",
      "fileMaxSize": 536870912
  },
  "state": {
      "stateId": ""
  },
  "product": {
      "allowAddPages": true,
      "allowAddPagesUploading": false,
      "allowDeletePages": true,
      "pages": [{title: 'First'}, {title: 'Second'}],
      "dpi": 300,
      "bleed": 20,
      "bleedLineWidth": 0.5,
      "bleedLineColor": "#0000ff",
      "trimLineWidth": 0.5,
      "trimLineColor": "#ff0000",
      "size": {
          "width": 720,
          "height": 576
      },
      "safetyLines": [{
          "name": "bleed",
          "margin": 40,
          "color": "#00ff00",
          "altColor": "#00ff00",
          "stepPx": 5,
          "widthPx": 1,
          "borderRadius": 0,
          "pages": [],
          "legend": {
              "title": "Bleed line",
              "description": "Keep important content inside"
          }
      }],
      "mockup": {
          "size": { width: 0, height: 0 },
          "location": { x: 0, y: 0 },
          "image": "",
          "sourceType": ""
      }
  },
  "viewer": {
      "locked": false,
      "shadeBleedZone": false,
      "bleedZoneColor": "",
      "keepAspectRatio": false,
      "highlightImages": true,
      "rulers": {
          "enabled": true,
          "unit": "inch",
          "customUnitScale": 1,
          "origin": { "x": 0, "y": 0 }
      },
      "zoom": {
          "min": 0.2,
          "max": 1.2,
          "step": 0.1,
          "default": 1,
          "mode": "none",
          "zoomValues": []
      }
  },
  "rules": [{
      "type": "colorspace",
      "severity": "error",
      "enableFix": true,
      "pages": [],
      "params": {
          "allowedColorSpaces": ["cmyk"]
      }
  }],
  "rendering": {
      "hiResOutputDpi": 300,
      "hiResOutputToSeparateFiles": false,
      "hiResOutputPdfCompressionType": "Jpeg",
      "hiResOutputJpegCompressionQuality": 90,
      "trimPreviewOnBleed": true,
      "showTrimLineOnPreview": false,
      "keepPdfOriginalColors": false,
      "cmykColorProfileId": "",
      "grayscaleColorProfileId": "",
      "rgbColorProfileId": "",
      "previewSize": {
          "width": 800,
          "height": 800
      },
      "hiResOutputPdfMetadata": {
          "author": "",
          "creator": "",
          "keywords": "",
          "subject": "",
          "title": ""
      }
  },
  "interface": {
      "topToolbar": [{
          "name": "upload",
          "visibility": "",
          "enabled": "",
          "style": {
              "background-color": "white"
          }
      }],
      "rightToolbar": {
          "infoCard": {
              "isDialog": true,
              "trimTitleStyles": {},
              "bleedTitleStyles": {},
              "safetyLinesTitleStyles": {},
              "importantTitleStyles": {},
              "textStyles": {}
          },
          "reportCard": {
              "useCustomLayout": false,
              "cardTitleStyles": {},
              "errorTitleStyles": {},
              "warningTitleStyles": {},
              "messageStyles": {},
              "pageButtonStyles": {},
              "fixButtonStyles": {}
          }
      },
      "leftToolbar": {
          "hideForSinglePageProduct": false
      },
      "customButtons": [{
          "title": "Fix all",
          "filter": {
              "severity": ["error"],
              "types": ["colorspace"]
          },
          "style": {
              "background-color": "white"
          }
      }]
  }
}

Now, let's see the description of these configuration parameters and their values.

NameData typeDescription
languagestringThe language of the user interface, either "en" or "nl". The default value is "en".
backendUrlstringThe URL that links to the running back end.
startFromUploaderbooleanIf true, displays the file uploader when opening the Preflight Tool. The default value is true.

Handling server errors

object: mode

NameData typeDescription
ignoreServerErrorsbooleanIf true, all server errors will be written to the logs, and requests will be limited by the requestTimeout. If an error occurs, or the request timed out, then an empty successful response will be returned from the server. When fixing a rule fails, this rule will be ignored later. If the error occurred when the user clicks Finish, then rendering will be skipped, and the original image will be returned. The default value is false.
requestTimeoutnumberThe timeout, in seconds, after which a long-running request will be interrupted and an empty successful response will be returned. By default, requests last as long as needed.

The file uploader

object: uploader

NameData typeDescription
fileTypesarray containing any combination of ".pdf", ".ai", ".bmp", ".eps", ".gif", ".jpg", ".jpeg", ".png", ".psd", ".tiff"Extensions of files that a user is allowed to upload to the Preflight Tool. The default value is [".pdf"].
multiplebooleanIf true, this parameter enables multiple selection of files to be uploaded. In this case, the Preflight Tool creates a multipage document, and the page order is the same as their upload order. The number of the uploaded pages cannot exceed the product.pages value. The default value is true.
initialMode"fitToBleed", "fitToTrim", "fillToTrim", "fillToBleed", "default"Defines how the file should be adjusted after it is uploaded. You can fit or fill the file to the product BleedBox and TrimBox. By default, the file is inserted as is.
fileUploadBehavior"replaceFull", "insertCurrent", "insertNew"Defines how the file should be placed on the pages.
  • "replaceFull" - clears the product and inserts the file starting from the first page.
  • "insertCurrent" - inserts the uploaded file starting from the current page.
  • "insertNew" - inserts the uploaded file into the newly added pages.
The default value is "insertCurrent".
fileMaxSizenumberThe maximum allowed size of uploaded files, in bytes. The default value is 536870912.

Loading state files

object: state

NameData typeDescription
stateIdstringThe identifier of the state file in Asset Storage.

Products

object: product

NameData typeDescription
allowAddPagesbooleanAllows users to add new pages to the product. The default value is false.
allowAddPagesUploadingbooleanAutomatically adds pages to the product so that the entire multipage file opens in the Preflight Tool, even if this file has more pages than allowed by the pages or pages.max value or the size of the Page array. The default value is false, and adds no more pages than allowed in pages.
allowDeletePagesbooleanAllows users to delete pages from the product. The default value is false.
pagesnumber | Page[] | PageLimitDefines either an array of product pages or the number of pages. A Page object contains a title property and allows you to define page titles in the user interface. PageLimit contains the init, min, and max properties and allows you to set the initial number of pages as well as page number limits. The default value is 1. For details, see How to Set Product Pages.
dpinumberThe resolution of the output image. The default value is 300.
bleednumber | IMarginLTRB | IMarginHVThe bleed zone. This margin extends the resulting image. The default value is 0.
bleedLineWidthnumberThe width of the bleed line, in points. This property changes only the visual representation in the veiwer and does not affect rendering to the print file. The default value is 0.5.
bleedLineColorstringThe color of bleed lines in the CSS format.
trimLineWidthnumberThe width of the trim lines, in points. This property changes only the visual representation in the veiwer and does not affect rendering to the print file. The default value is 0.5.
trimLineColorstringThe color of trim lines in the CSS format.

The product size

object: size

NameData typeDescription
widthnumberThe width of the resulting image, in points.
heightnumberThe height of the resulting image, in points.

Safety lines on the previews

object: safetyLines

NameData typeDescription
namestringThe name of the safety lines, an arbitrary string.
marginnumberThe distance between safety lines and design bounds.
colorstringThe main color of safety lines in the CSS format.
altColorstringThe alternative color of safety lines in the CSS format.
stepPxnumberThe length of the safety line dashes.
widthPxnumberThe width of safety lines.
borderRadiusstring or numberThe definition of rounded corners in the CSS format. For details, see the Safety zone topic.
pagesnumber[] | string[]When this array contains numbers, then they are product page numbers starting from 1. For example, to apply the safety lines to the first and third pages, specify [1,3]. If there are strings, they must be in the "/N" format, and safety lines will be applied to every Nth page. For example, to apply the safety lines to every third pages, specify ["/3"]. By default, this is an empty array. Note that an empty array (as well as an unspecified value) means that page limits are not applied.

The safety line description

object: safetyLines.legend

NameData typeDescription
titlestringThe title of the safety line, which appears on the right panel.
descriptionstringThe description of the safety line, which appears on the right panel.

Mockups

object: mockup

NameData typeDescription
sizeobjectThe width and height of the mockup, in points. If not set, the mockup fills in the entire product. Note that the real size of the mockup should be equal to or greater than the product size.
locationobjectThe position of the upper-left corner of the mockup. The default value is { x: 0, y: 0 }.
imagestringIf sourceType is "web", it should be the URL to the image; if sourceType is "local", it should be the name of a file in the mockup folder; if sourceType is "assetStorage", it should be the ID or the path to resource in asset storage.
sourceType"assetStorage", "local", "web"The asset source type. The default value is "web".

The Viewer

object: viewer

NameData typeDescription
lockedbooleanIf true, does not allow for manipulating elements. The default value is false.
shadeBleedZonebooleanIf true, applies the bleedZoneColor to the bleed zone. The default value is false.
bleedZoneColorstringThe color of the bleed zone is applied when shadeBleedZone is true. The default value is "cmyk(0%,0%,0%,50%,50%)".
keepAspectRatiobooleanIf true, maintains the design aspect ratio. The default value is true.
highlightImagesbooleanIf true, highlights images in the viewer that have preflight problems. The default value is false.

Rulers

object: rulers

NameData typeDescription
enabledbooleanIf true, displays the rulers. The default value is true.
unit"inch", "mm", "cm", "point", "custom"The measurement unit of the rulers. The default value is 'inch'.
customUnitScalenumberThe ratio of the custom unit to points. This parameter is applied only if the unit parameter is set to "custom". For more details, you can refer to the Rulers and grids topic. The default value is 1.
originobjectThe point of origin relative to the upper-left corner of the design. The coordinates are measured in the units specified by the unit parameter. The default value is { "x": 0, "y": 0 }.

Viewer zoom

object: zoom

NameData typeDescription
minnumberThe minimum zoom of the viewer. The default value is 0.1.
maxnumberThe maximum zoom of the viewer. The default value is 1.5.
stepnumberThe step of increasing or decreasing the zoom level of the viewer. The default value is 0.1.
defaultnumberThe initial zoom value of the viewer. This parameter has a higher priority than the zoom mode. The default value is 1.
mode"none", "bestFit", "bestFitShrinkOnly", "fitToWidth", "fitToHeight", "fitToWidthShrinkOnly", "fitToHeightShrinkOnly"This parameter only works when you do not specify zoom.default in the configuration. For example, you can place an entire large product in the viewer if you omit zoom.default and set zoom.mode to "bestFit". The default value is "none".
zoomValuesnumber[]This array of positive numbers defines the design zoom levels in the viewer. For example, 0.1 corresponds to the 10% zoom, and 1 corresponds to the 100% level. By default, this is an empty array.

Preflight rules

object: rules

NameData typeDescription
type"colorspace", "spotcolors", "resolution", "safetyboxes", "nomargins", "insideBleedbox", "sameorientation", "forbiddenfonts", "allowedfonts", "fonttypes", "minfontsize", "textascurves", "embeddedfonts"The rule type. For more details, see the rules topic.
severity"error", "warning"The rule severity. All errors must be fixed before rendering the resulting image, whereas warnings may remain on the design.
enableFixbooleanIf true, displays the Fix button to autofix errors.
pagesnumber[] | string[]When this array contains numbers, then they are product page numbers starting from 1. For example, to apply the rules to the first and third pages, specify [1,3]. If there are strings, they must be in the "/N" format, and rules will be applied to every Nth page. For example, to apply the rules to every third pages, specify ["/3"]. By default, this is an empty array. Note that an empty array (as well as an unspecified value) means that page limits are not applied.
paramsobjectParameters of the rule depending on its type. For more details, see the rules topic.

Rendering settings

object: rendering

NameData typeDescription
hiResOutputDpiintegerHi-res output resolution in dots per inch (DPI). The default value is 300.
hiResOutputToSeparateFilesbooleanIf true, the hi-res output for each page of a multipage product is put in a separate file. The default value is false.
hiResOutputPdfCompressionType"Jpeg", "Zip", "None"The type of PDF file compression. The default value is "None", and no compression is performed. For "Jpeg", hiResOutputJpegCompressionQuality is additionally applied.
hiResOutputJpegCompressionQualityinteger in the range [0 .. 100]JPEG compression quality in percent. The default value is 90.
trimPreviewOnBleedbooleanIf true, trims preview images and page thumbnails to the Bleed area. The default value is true.
showTrimLineOnPreviewbooleanIf trimPreviewOnBleed is false and this value is true, displays trim lines on preview images. The default value is false.
keepPdfOriginalColorsbooleanIf true, saves the output PDF file with the original color profile. The default value is false.
cmykColorProfileIdstringThe identifier of the CMYK color profile in Asset Storage.
grayscaleColorProfileIdstringThe identifier of the grayscale color profile in Asset Storage.
rgbColorProfileIdstringThe identifier of the RGB color profile in Asset Storage.

The size of preview images

object: previewSize

NameData typeDescription
widthnumberThe width of preview images, in pixels. The default value is 800.
heightnumberThe height of preview images, in pixels. The default value is 800.

PDF metadata

object: hiResOutputPdfMetadata

NameData typeDescription
authorstringThe author of the PDF document.
creatorstringThe creator of the PDF document.
keywordsstringKeywords of the PDF document.
subjectstringThe subject of the PDF document.
titlestringThe title of the PDF document.

The user interface

object: interface

Top Toolbar buttons

object: topToolbar

NameData typeDescription
namestringThe button name. In the current implementation, you can use the following predefined button names: "upload", "fillToBleed", "fillToTrim", "fitToBleed", "fitToTrim", "center", "reset", "keepAspectRatio", "rotateCanvas", "rotateImage", "applyToAll", "fullscreen", "history".
visibility"always", "topButtonChanges", "surfaceChanges"Defines when the button gets visible: always, when the current surface has changed with top buttons, or when the current surface has changed in some way.
enabled"always", "topButtonChanges", "surfaceChanges"Defines when the button gets enabled: always, when the current surface has changed with top buttons, or when the current surface has changed in some way.

Style of a Top toolbar button

object: style

NameData typeDescription
<property>stringCSS properties. You can specify a new style through a key-value pair, where the key is the property name, and the value is in the CSS format or a CSS variable. For example, you can change the button color, background-color, and more. For an example of customizing the Fix All button, you can refer to how-to guides.

The right panel

object: rightToolbar

Legend

object: rightToolbar.infoCard

NameData typeDescription
isDialogbooleanIf true, displays the legend in the modal window. If false, displays the legend on the panel. The default value is true.
trimTitleStyles bleedTitleStyles safetyLinesTitleStyles importantTitleStyles textStylesobjectFor every object defining the style, you can configure the following font properties:
{
"font-family": "Work Sans",
"font-weight": "600",
"font-size": "16px",
"line-height": "19px",
"color": "#414042"
}

Preflight report

object: rightToolbar.reportCard

NameData typeDescription
useCustomLayoutbooleanIf true, displays a plain error list first and the buttons at the panel bottom. If false, displays the buttons first and errors in drop-down lists. The default value is false.
cardTitleStyles errorTitleStyles warningTitleStyles messageStyles pageButtonStyles fixButtonStylesobjectFor every object defining the style, you can configure the following font properties:
{
"font-family": "Work Sans",
"font-weight": "600",
"font-size": "16px",
"line-height": "19px",
"color": "#414042"
}

The left panel

object: leftToolbar

NameData typeDescription
hideForSinglePageProductbooleanIf true, hides the pagination control for single-page products. This property assumes that no new pages can be added, meaning product.allowAddPages is set to false. The default value is false.

Custom Fix buttons

object: customButtons

NameData typeDescription
titlestringThe button title that appears on the right panel.

Preflight rules to fix

object: filter

NameData typeDescription
severityarraySeverity of the rules to be fixed with the button. This array may contain "error", "warning", or both.
typesarrayThis array may contain any combination of rule types.

Style of a custom button

object: style

NameData typeDescription
<property>stringCSS properties. You can specify a new style through a key-value pair, where the key is the property name, and the value is in the CSS format or a CSS variable. For example, you can change the button color, background-color, and more. For an example of customizing the Fix All button, you can refer to how-to guides.
Was this page helpful?