Search
Loading...
Skip to content

Export for Printing

Export print-ready PDFs from CE.SDK with options for high compatibility mode, underlayers for special media like fabric or glass, and configurable output resolution.

10 mins
estimated time
Download
StackBlitz
GitHub

CE.SDK exports designs as PDFs, but professional print workflows require specific configurations beyond standard export. This guide covers PDF export options for print, including high compatibility mode for complex designs, underlayers for printing on special media, and output resolution settings.

Default PDF Color Behavior#

CE.SDK exports PDFs in RGB color space. CMYK or spot colors defined in your design convert to RGB during standard export. For CMYK output with ICC profiles, use the Print Ready PDF plugin.

The base engine.block.export() method provides print compatibility options, but full CMYK workflow requires the plugin.

Setting Up for Print Export#

Before exporting, configure your scene with appropriate print settings. Set the scene’s DPI to control print resolution—300 DPI is standard for high-quality print output.

// Load a template scene - this will be our print design
await engine.scene.loadFromURL(
'https://cdn.img.ly/assets/demo/v1/ly.img.template/templates/cesdk_postcard_1.scene'
);
// Get the scene and page
const scene = engine.scene.get();
if (!scene) {
throw new Error('No scene found');
}
const page = engine.scene.getCurrentPage();
if (!page) {
throw new Error('No page found');
}
// Set print resolution (DPI) on the scene
// 300 DPI is standard for high-quality print output
engine.block.setFloat(scene, 'scene/dpi', 300);

PDF Export Options for Print#

Export a page as PDF using engine.block.export() with mimeType: 'application/pdf'.

High Compatibility Mode#

The exportPdfWithHighCompatibility option rasterizes complex elements like gradients with transparency at the scene’s DPI. Enable this when:

  • Designs use gradients with transparency
  • Effects or blend modes render inconsistently across PDF viewers
  • Maximum compatibility across print RIPs matters more than vector precision
// Enable high compatibility mode for consistent rendering across PDF viewers
// This rasterizes complex elements like gradients with transparency at the scene's DPI
const highCompatPdf = await engine.block.export(page, {
mimeType: 'application/pdf',
exportPdfWithHighCompatibility: true
});

Disabling high compatibility produces faster exports with smaller file sizes but may cause rendering inconsistencies in some PDF viewers.

Standard PDF Export#

When targeting modern PDF viewers where file size and export speed matter more than universal compatibility:

// Disable high compatibility for faster exports when targeting modern PDF viewers
// Complex elements remain as vectors but may render differently across viewers
const standardPdf = await engine.block.export(page, {
mimeType: 'application/pdf',
exportPdfWithHighCompatibility: false
});

Underlayers for Special Media#

Underlayers provide a base ink layer (typically white) for printing on:

  • Transparent or non-white substrates
  • DTF (Direct-to-Film) transfers
  • Fabric, glass, or dark materials

Define the Underlayer Spot Color#

Before exporting with an underlayer, define the spot color that represents the underlayer ink. Use engine.editor.setSpotColorRGB() to create a named spot color with RGB preview values.

// Define the underlayer spot color before export
// This creates a named spot color that will be used for the underlayer ink
// The RGB values (0.8, 0.8, 0.8) provide a preview representation
engine.editor.setSpotColorRGB('RDG_WHITE', 0.8, 0.8, 0.8);

Export with Underlayer#

Enable exportPdfWithUnderlayer and specify the underlayerSpotColorName to generate an underlayer from design contours. The underlayer offset controls the size adjustment—negative values shrink the underlayer inward to prevent visible edges from print misalignment.

// Export with underlayer enabled for DTF or special media printing
// The underlayer generates a shape behind design elements filled with the spot color
const underlayerPdf = await engine.block.export(page, {
mimeType: 'application/pdf',
exportPdfWithHighCompatibility: true,
exportPdfWithUnderlayer: true,
underlayerSpotColorName: 'RDG_WHITE',
// Negative offset shrinks the underlayer inward to prevent visible edges
underlayerOffset: -2.0
});

Underlayer Offset#

The underlayerOffset option adjusts the underlayer size in design units. Negative values shrink the underlayer inward, which prevents visible white edges when the print layers don’t align perfectly. Start with values like -1.0 to -3.0 and adjust based on your print equipment’s alignment accuracy.

Export with Target Size#

Control the exported PDF dimensions using targetWidth and targetHeight. These values are in pixels and work together with the scene’s DPI setting to determine physical print size.

// Export with specific dimensions for print output
// targetWidth and targetHeight control the exported PDF dimensions in pixels
const targetSizePdf = await engine.block.export(page, {
mimeType: 'application/pdf',
exportPdfWithHighCompatibility: true,
targetWidth: 2480, // A4 at 300 DPI (210mm)
targetHeight: 3508 // A4 at 300 DPI (297mm)
});

Save to File System#

Convert the exported blob to a buffer and write it to disk using Node.js file system APIs.

// Convert blob to buffer and write to file system
const highCompatBuffer = Buffer.from(await highCompatPdf.arrayBuffer());
writeFileSync('print-high-compatibility.pdf', highCompatBuffer);
console.log(
`High compatibility PDF exported (${(highCompatBuffer.length / 1024).toFixed(1)} KB)`
);

CMYK PDFs with ICC Profiles#

For CMYK color space and ICC profile embedding, use the Print Ready PDF plugin. This plugin post-processes exports to convert RGB to CMYK with embedded ICC profiles.

See the Print Ready PDF Plugin for setup and usage.

Troubleshooting#

PDF Not Opening Correctly in Print Software#

Enable exportPdfWithHighCompatibility: true to rasterize complex elements that may not render correctly in prepress software.

Underlayer Not Visible in PDF Viewer#

Standard PDF viewers may not display spot colors. Use professional print software like Adobe Acrobat Pro or prepress tools to verify the underlayer separation.

Colors Look Different After Printing#

Standard export uses RGB. Use the Print Ready PDF plugin with appropriate ICC profiles for accurate CMYK reproduction.

White Edges on Special Media#

Increase the negative underlayerOffset value to shrink the underlayer further from design edges. Try values like -2.0 or -3.0 depending on your equipment’s alignment tolerance.

API Reference#

Method/OptionPurpose
engine.block.export(block, options)Export block to PDF
mimeType: 'application/pdf'Specify PDF output format
targetWidthTarget width for exported PDF in pixels
targetHeightTarget height for exported PDF in pixels
exportPdfWithHighCompatibilityRasterize bitmap images and gradients at scene DPI (default: true)
exportPdfWithUnderlayerGenerate underlayer from contours (default: false)
underlayerSpotColorNameSpot color name for underlayer ink
underlayerOffsetSize adjustment in design units (negative shrinks)
engine.editor.setSpotColorRGB(name, r, g, b)Define spot color for underlayer
engine.block.setFloat(scene, 'scene/dpi', value)Set scene DPI for print resolution
writeFileSync(path, buffer)Write buffer to file system (Node.js)

Next Steps#