Back to Website
Show / Hide Table of Contents

Check

  • 1 minute to read

You can pass an array of preflight rules and a URL that link to a print file to check whether this file matches the rules. In the current implementation, you can use the POST ~/api/rules/check endpoint to check the following rules through this Web API:

  • "colorspace"
  • "spotcolors"
  • "resolution"
  • "sameorientation"
  • "forbiddenfonts"
  • "allowedfonts"
  • "fonttypes"
  • "minfontsize"
  • "textascurves"
  • "embeddedfonts"

Request Payload

To validate your print file, you can pass its name, resolution, and required rules in the request body in the following format.

{
    "file": "http://example.com/pt/api/files/get/425a3537-2e59-450d-bbc2-484fcd3d63bd.pdf",
    "dpi": 200,
    "rules": [
        {
            "type": "embeddedfonts"
        }
    ]
}

Example call

// The link to the print file.
const file = appUrl + "api/files/get/425a3537-2e59-450d-bbc2-484fcd3d63bd.pdf";
// Resolution of the print file.
const dpi = 300;
// The required color space and page orientation.
const rules = [
    {
        "type": "colorspace",
        "params": {
            "allowedColorSpaces": ["cmyk"]
        }
    },
    {
        "type": "sameorientation"
    }
];
// Check the file.
const check = async () => {
    const response = await fetch(appUrl + "api/rules/check", {
        method: "post",
        body: JSON.stringify({ dpi, file, rules }),
        headers: {
            'Content-Type': 'application/json'
        }
    });
    const result = await response.json();
    // Output the resulting array, where each element is an array of preflight results for a page.
    console.log(result);
}

Success response

This endpoint returns an array, where each element corresponds to a page in the print file. These elements contain validation results. The result of validation of a one-page PDF file may look as follows:

Status Code: 200 OK
Content:
[
    [
        {
            name: "colorspace",
            result: false,
            expected: ["cmyk"],
            actual: ["rgb"]
        },
        {
            name: "sameorientation",
            result: true,
            expected: ["horizontal"],
            actual: []
        }
    ]
]
Was this page helpful?
Thanks for your feedback!
Back to top Copyright © 2001–2024 Aurigma, Inc. All rights reserved.
Loading...
    Thank for your vote
    Your opinion is important to us. To provide details, send feedback.
    Send feedback