Export your designs as PDF documents with high compatibility mode and underlayer support for special media printing.
PDF provides a universal document format for sharing and printing designs. CE.SDK exports PDF files that preserve vector graphics, support multi-page documents, and include options for print compatibility. You can configure high compatibility mode to ensure consistent rendering across different PDF viewers, and generate underlayers for special media printing like fabric, glass, or DTF transfers.
This guide covers exporting designs to PDF format, configuring high compatibility mode, controlling the quality of rasterized images, generating underlayers with spot colors, and controlling output dimensions.
Export to PDF#
Call engine.block.export() with mimeType: 'application/pdf' to export any block as a PDF document. The method returns a Blob containing the PDF data.
// Export scene as PDF (includes all pages)const blob = await engine.block.export(scene, { mimeType: 'application/pdf', onProgress});Pass the scene ID from engine.scene.get() to export all pages as a multi-page PDF. You can also pass a single page ID from engine.scene.getCurrentPage() if you only need to export one page.
Track Export Progress#
Server-side exports of large multi-page documents can run for a while. Pass an onProgress callback to report how far the export has advanced, which is a natural hook for a job-status update or a log line.
// Report per-page progress as the PDF is written. The callback runs once per// page; only PDF exports invoke it. On the server this is a natural place to// update a job status or log line for long multi-page exports.const onProgress = (exportedPages: number, totalPages: number) => { console.log(` Exported ${exportedPages} of ${totalPages} pages`);};The callback fires once after each page is serialized into the document, receiving the number of pages exported so far and the total page count. A PNG, JPEG, WebP, TGA or raw export that renders in more than one strip reports its strips to the same callback.
Define it once and pass it to every export, as this example does. There is no reason to leave a server-side export unreported: the callback costs nothing when a document turns out to be a single page, and it is the only way to tell a stalled job from a slow one.
Cancel a Running Export#
Pass an abortSignal to stop an export whose result nobody waits for any more, for example when the client of a job has gone away or a deadline has passed. The promise rejects and no file is produced.
const controller = new AbortController();// Stop the export after 30 seconds, or call abort() from your own job handler.const deadline = setTimeout(() => controller.abort(), 30_000);
try { const blob = await engine.block.export(scene, { mimeType: 'application/pdf', abortSignal: controller.signal, onProgress }); writeFileSync(`${outputDir}/design.pdf`, Buffer.from(await blob.arrayBuffer()));} catch (error) { console.log('Export cancelled', error);} finally { clearTimeout(deadline);}For a multi-page PDF the engine stops at the next page boundary, so the pages that are still queued are never rendered and the worker is free for the next job. Every other export stops at once, for example while it waits for an image to load.
Export Animated Pages at a Cover Time#
A page of an animated or video scene exports at its playback time. So each page of a slide deck shows the moment where its playhead rests. Give each page a cover time to export a fixed moment instead, like the poster frame of a slide.
// Show each page at 2 seconds, whatever its playback time is.// The scene keeps the cover times, so later exports use them too.for (const page of engine.block.findByType('page')) { engine.block.setDouble(page, 'playback/coverTime', 2); engine.block.setBool(page, 'playback/coverTimeEnabled', true);}const blob = await engine.block.export(scene, { mimeType: 'application/pdf', onProgress});Set playback/coverTime to the time in seconds on the page, and playback/coverTimeEnabled to true. Each page exports at its own cover time, and its playback time does not change. A cover time after the end of the page shows the end of the page. The scene saves both properties, so a template can carry its cover times.
The cover time also applies to PNG, JPEG, WebP and SVG exports of the page or its scene, and to the preview image of a saved archive. An MP4 export of the page uses it for its cover, unless coverTimeOffset sets the cover. An export of a single block on the page still uses the playback time of the page.
Configure High Compatibility Mode#
Enable exportPdfWithHighCompatibility to rasterize complex elements like gradients with transparency at the scene’s DPI. This ensures consistent rendering across all PDF viewers.
// Enable high compatibility mode for consistent rendering across PDF viewersconst blob = await engine.block.export(scene, { mimeType: 'application/pdf', exportPdfWithHighCompatibility: true, onProgress});Use high compatibility mode when:
- Designs contain gradients with transparency
- Effects or blend modes render inconsistently across viewers
- Maximum compatibility matters more than vector precision
High compatibility mode increases file size because complex elements are converted to raster images rather than remaining as vectors.
Control the Size of Rasterized Images#
When exportPdfWithHighCompatibility is false, CE.SDK embeds the original data of unmodified JPEG images directly into the PDF. This keeps exports of photo-heavy documents such as photo books fast and small, because the photos are not decoded and encoded again.
CE.SDK must rasterize images that it cannot embed directly, for example images with effects or blurs applied, or every bitmap image when high compatibility mode is enabled. By default these images are encoded losslessly. Set pdfImageQuality to a value below 1.0 to encode them as lossy JPEG instead, which produces much smaller files.
const pdfBlob = await engine.block.export(page, { mimeType: 'application/pdf', pdfImageQuality: 0.85});Valid values are greater than 0 and at most 1.0. The default of 1.0 keeps the lossless encoding, in the same way as webpQuality. Images that are embedded as their original JPEG data are never encoded again, so this option does not change them.
Generate Underlayers for Special Media#
Underlayers provide a base ink layer (typically white) for printing on transparent or non-white substrates like fabric, glass, or acrylic. The underlayer sits behind your design elements and provides opacity on transparent materials.
Define the Underlayer Spot Color#
Before exporting, define a spot color that represents the underlayer ink. The RGB values provide a preview representation in PDF viewers.
engine.editor.setSpotColorRGB('RDG_WHITE', 0.8, 0.8, 0.8);The spot color name (e.g., 'RDG_WHITE') must match your print provider’s requirements. Common names include RDG_WHITE for Roland DG printers and White for other systems.
Export with Underlayer Options#
Configure the underlayer spot color name and optional offset. The underlayerOffset adjusts the underlayer size in design units—negative values shrink it inward to prevent visible edges from print misalignment (trapping). Thin text and lines can lose their underlayer when the offset shrinks it. Set underlayerMinFeatureWidth to keep each thin part at least that wide, in the same unit as underlayerOffset.
// Export with underlayer for special media printingconst blob = await engine.block.export(scene, { mimeType: 'application/pdf', exportPdfWithHighCompatibility: true, exportPdfWithUnderlayer: true, underlayerSpotColorName: 'RDG_WHITE', underlayerOffset: -2.0, onProgress});The underlayer is generated automatically from the contours of all design elements on the page. Elements with transparency will have proportionally reduced underlayer opacity.
Add Printer’s Marks#
A print shop needs to see where to cut, and a press operator needs a target to align the plates against. Set exportPdfWithCropMarks to draw the four pairs of corner lines that mark the cut, and exportPdfWithRegistrationMarks to draw a bullseye at the middle of each page edge. On a page with page slices, such as a tri-fold leaflet, set exportPdfWithFoldMarks to mark each fold. Crop marks draw no fold marks. All three options default to false, so an export that does not ask for marks is unchanged.
const pdfBlob = await engine.block.export(page, { mimeType: 'application/pdf', exportPdfWithCropMarks: true, exportPdfWithFoldMarks: true, exportPdfWithRegistrationMarks: true, printMarkOffset: 6, printMarkWidth: 0.25, cropMarkLength: 15});Every mark type is painted in the PDF registration colorant All, so it appears on every separation, and each is knocked out in white underneath so it stays legible over dark artwork.
printMarkOffset and printMarkWidth are shared by every mark type, and cropMarkLength sets one corner line. The offset and the length are in design units, so the offset is directly comparable with the page bleed and the sheet grows by the sum of the two. The weight is in points, the unit a print shop states a stroke weight in.
The offset is measured from the trim, so a small offset places a mark inside the bleed, which the knife removes anyway. A negative offset falls back to the 6 pt default, and 0 places a mark on the trim edge.
Marks grow the exported page by the offset plus the equivalent of 15 points on each side, or by the offset plus cropMarkLength when that is longer. The artwork does not move, and the TrimBox and BleedBox keep describing the same physical rectangles. A page whose trim is not a rectangle gets no marks and no larger page.
A fold is at the start of each visible page slice that follows another visible page slice. With exportPdfWithFoldMarks, each fold gets a fold mark pair: a solid line on the extension of the fold, one on each side of the page. A fold mark uses the offset, weight and length of the crop marks. A fold never moves or removes a registration mark. At a fold in the middle of a page edge, the fold mark lies over the registration mark. Fold marks grow the exported page on the same terms as crop marks. With both options, they share one margin. A page without a fold gets no fold marks and no larger page. A printer wants the whole sheet of a folded product, with the bleed, the crop marks and the fold marks. Folded Products and Spreads shows how to build one.
Export Each Page Slice as a PDF Page#
Set exportPdfPageSlices to export each page slice of a page as its own PDF page, in reading order. The option applies to the PDF export of a scene or of one page, and defaults to false.
const pdfBlob = await engine.block.export(page, { mimeType: 'application/pdf', exportPdfPageSlices: true});Each PDF page holds the part of the page inside the page slice, with the bleed of the page on all four sides. With a bleed or printer’s marks, it has a TrimBox and a BleedBox, as a page has. A PDF page of one page slice gets no fold marks.
A hidden page slice gets no PDF page. It keeps its room in the layout, and the content it owns shows in no PDF page. An export of one page whose page slices are all hidden gives the whole page as one PDF page. A page that is not included in the export keeps its PDF pages, without content. A page without page slices stays one PDF page.
To export one page slice alone, pass the page slice to the export call, in any format. The result is the part of the page inside the page slice, with the bleed of the page on all four sides.
Export at Target Dimensions#
Use targetWidth and targetHeight to control the exported PDF dimensions in pixels. The block renders large enough to fill the target size while maintaining aspect ratio.
// Export with specific dimensions for print outputconst blob = await engine.block.export(scene, { mimeType: 'application/pdf', targetWidth: 2480, targetHeight: 3508, onProgress});For print output, calculate the target dimensions based on your desired DPI:
- A4 at 300 DPI: 2480 × 3508 pixels
- Letter at 300 DPI: 2550 × 3300 pixels
PDF Export Options#
| Option | Description |
|---|---|
mimeType |
Output format. Must be 'application/pdf'. |
exportPdfWithHighCompatibility |
Rasterize complex elements at scene DPI for consistent rendering. Defaults to true. |
pdfImageQuality |
Encoding quality for images that CE.SDK has to rasterize. Values below the default of 1.0 encode them as lossy JPEG. |
exportPdfWithUnderlayer |
Generate an underlayer from design contours. Defaults to false. |
underlayerSpotColorName |
Spot color name for the underlayer ink. Required when exportPdfWithUnderlayer is true. |
underlayerOffset |
Size adjustment in design units. Negative values shrink the underlayer inward. |
underlayerMinFeatureWidth |
Smallest width, in design units, that a thin part keeps when a negative underlayerOffset shrinks the underlayer. 0 turns it off. Defaults to 0. |
exportPdfWithCropMarks |
Draw the four pairs of corner lines that show a print shop where to cut. Crop marks draw no fold marks. Defaults to false. |
exportPdfWithFoldMarks |
On a page with page slices, draw a fold mark pair at each fold. Defaults to false. |
exportPdfWithRegistrationMarks |
Draw a bullseye target at the middle of each page edge, which a press operator aligns the plates by. Defaults to false. |
exportPdfPageSlices |
Export each page slice of a page as its own PDF page, in reading order. Defaults to false. |
printMarkOffset |
Distance in design units from the trim to the nearest edge of any mark, so it is comparable with the page bleed. Shared by every mark type. Defaults to 6 pt. |
printMarkWidth |
Stroke weight in points of any mark, the unit a print shop states a weight in. Shared by every mark type. Defaults to 0.25. |
cropMarkLength |
Length in design units of one crop mark line and of one fold mark line, the same unit as printMarkOffset. Defaults to 15 pt. |
targetWidth |
Target output width in pixels. Alone, the height follows from the aspect ratio. |
targetHeight |
Target output height in pixels. Alone, the width follows from the aspect ratio. |
onProgress |
Callback invoked once per page during PDF export with (exportedPages, totalPages). A raster export of more than one strip reports its strips to it. |
pdfChunkSize |
Upper bound in bytes for a single chunk the PDF encoder hands to the export. Tunes the memory the export holds while it runs; it does not change the returned document. Defaults to an engine-chosen 512 KiB. Other values are clamped to 4 KiB to 64 MiB. |
outputColorSpace |
Color space of the PDF output, 'RGB' (default) or 'CMYK'. 'CMYK' writes CMYK colors as DeviceCMYK, and spot colors as Separations with a DeviceCMYK alternate. RGB colors stay RGB with 'Off', and convert with the other modes. See Export for Printing. |
outputProfileMode |
What the export does with the document’s Output profile: 'Off' (default), 'Convert' converts every solid color and image into it, 'Assign' keeps the colors already in its space and converts the others. See Export for Printing. |
embedProfiles |
Write the Output profile into the PDF as the OutputIntent. Defaults to false. |
preserveBlack |
Keep black pure while colors convert: exact RGB black becomes K-only black in a CMYK output, and K-only black becomes exact RGB black in an RGB output. Defaults to false. |
abortSignal |
Signal that cancels the export. A multi-page PDF export stops at the next page boundary. |
API Reference#
| Method | Description |
|---|---|
engine.block.export(blockId, options) |
Export a block as PDF with format and compatibility options |
engine.editor.setSpotColorRGB(name, r, g, b) |
Define a spot color for underlayer ink |
engine.block.setDouble(page, 'playback/coverTime', seconds) |
Set the moment that a still export of the page shows |
engine.block.setBool(page, 'playback/coverTimeEnabled', true) |
Export the page at its cover time instead of its playback time |
engine.scene.get() |
Get the scene for multi-page PDF export |
engine.scene.getCurrentPage() |
Get the current page for single-page export |
Next Steps#
- Export Overview - Compare all supported export formats
- Export for Printing - Print workflows with DPI and color management
- Spot Colors - Define and use spot colors in designs
- Export Size Limits - Check device limits before exporting large designs