Search
Loading...
Skip to content

To PDF

Export your designs as PDF documents with high compatibility mode and underlayer support for special media printing.

10 mins
estimated time
Download
StackBlitz
GitHub

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, 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'
});

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.

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 viewers
const blob = await engine.block.export(scene, {
mimeType: 'application/pdf',
exportPdfWithHighCompatibility: true
});

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.

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).

// Export with underlayer for special media printing
const blob = await engine.block.export(scene, {
mimeType: 'application/pdf',
exportPdfWithHighCompatibility: true,
exportPdfWithUnderlayer: true,
underlayerSpotColorName: 'RDG_WHITE',
underlayerOffset: -2.0
});

The underlayer is generated automatically from the contours of all design elements on the page. Elements with transparency will have proportionally reduced underlayer opacity.

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 output
const blob = await engine.block.export(scene, {
mimeType: 'application/pdf',
targetWidth: 2480,
targetHeight: 3508
});

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#

OptionDescription
mimeTypeOutput format. Must be 'application/pdf'.
exportPdfWithHighCompatibilityRasterize complex elements at scene DPI for consistent rendering. Defaults to true.
exportPdfWithUnderlayerGenerate an underlayer from design contours. Defaults to false.
underlayerSpotColorNameSpot color name for the underlayer ink. Required when exportPdfWithUnderlayer is true.
underlayerOffsetSize adjustment in design units. Negative values shrink the underlayer inward.
targetWidthTarget output width in pixels. Must be used with targetHeight.
targetHeightTarget output height in pixels. Must be used with targetWidth.
abortSignalSignal to cancel the export operation.

API Reference#

MethodDescription
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.scene.get()Get the scene for multi-page PDF export
engine.scene.getCurrentPage()Get the current page for single-page export

Next Steps#