Skip to content

About

Check print-file DPI and print-readiness with AI via the Printcart Preflight API — TypeScript/Node.js SDK example.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Printcart Preflight API — Print-Ready DPI Checker (TypeScript/Node.js)

A working code example for checking whether an image is print-ready using the Printcart Preflight API. Get a 5-star DPI rating in real time, or run a full print-readiness check (DPI, bleed, color mode, fonts) on a real file — before a customer's order goes to production. Runs on Node.js/TypeScript via @printcart/sdk-core, and needs a Printcart API key to call the real API.

npm License: MIT

Quickstart

git clone https://github.com/Printcart/printcart-preflight-sdk.git
cd printcart-preflight-sdk
npm install
cp .env.example .env   # add your PRINTCART_API_KEY
npm start
import { createPrintcartClient } from '@printcart/sdk-core'

const printcart = createPrintcartClient({ apiKey: process.env.PRINTCART_API_KEY! })

// Free, instant — no file upload needed.
const score = await printcart.preflight.dpiScore({
  widthPx: 4000,
  heightPx: 3000,
  canvasWidthInches: 30,
  canvasHeightInches: 20,
  productType: 'photo_on_canvas',
})

console.log(score.data.stars, score.data.label) // e.g. 4, "Good"

How it works

Two modes, matching two different use cases:

  • DPI Score (preflight.dpiScore) — a free, synchronous check computed purely from pixel dimensions and canvas size. Use this for instant UI feedback while a customer is still choosing a size.
  • Full check (preflight.createCheck) — validates a real file: DPI, bleed, color mode (RGB vs. CMYK), and embedded fonts. Runs as a report you can fetch/list/delete. From a report, preflight.createAiJob can auto-fix issues (upscale, add bleed, convert color mode) as a separate AI job.

Pricing

DPI Score is free. The full check is metered per your plan (no per-call token charge). AI fix jobs are billed separately — see the image upscale example for that flow specifically.

FAQ

What's the difference between DPI Score and a full preflight check? DPI Score only needs pixel dimensions + target size — no file download, near-instant, free. A full check downloads and inspects the actual file for DPI, bleed, color mode, and fonts, and returns a structured report with any issues found.

What product types are supported for DPI scoring? photo_on_canvas, poster, wallpaper, framed_print, wrapping_paper, stock_canvas — each has its own minimum-PPI threshold.

Can this auto-fix a low-DPI or wrong-color-mode file, not just flag it? Yes — preflight.createAiJob takes a report and applies fixes (upscale_resolution_2x/_4x, add_bleed, remove_transparency, sharpen_edges, resize_to_spec, convert_color_mode) as a billed async job you poll to completion.

Does this replace a human prepress reviewer? No — it catches the common, mechanically-detectable issues (low resolution, wrong color mode, missing bleed) before a file reaches production. It's a pre-check, not a full prepress replacement.

Where's the full API reference? This repo is a runnable example, not the full docs. For every field and endpoint, see the @printcart/sdk-core package.

Related

License

The example code in this repo is MIT. The Printcart API itself and @printcart/sdk-core require a Printcart account and API key to use — see printcart-sdk's LICENSE (Business Source License 1.1).

About

Check print-file DPI and print-readiness with AI via the Printcart Preflight API — TypeScript/Node.js SDK example.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages