Skip to main content
Platform
Language

Exporting to PDF with an underlayer

When printing on a non-white medium or on a special medium like fabric or glass, printing your design over an underlayer helps achieve the desired result. An underlayer will typically be printed using a special ink and be of the exact shape of your design.

When exporting to PDF, you can specify that an underlayer be automatically generated in the ExportOptions. An underlayer will be generated by detecting the contour of all elements on a page and inserting a new block with the shape of the detected contour. This new block will be positioned behind all existing block. After exporting, the new block will be removed. The result will be a PDF file containing an additional shape of the same shape as your design and sitting behind it.

The ink to be used by the printer is specified in the ExportOptions with a spot color. You can also adjust the scale of the underlayer shape with a negative or positive offset, in design units.

Warning#

Do not flatten the resulting PDF file or you will lose the underlayer shape which sits behind your design.

Explore a full code sample on Stackblitz or view the code on Github.

Setup the scene#

We first create a new scene with a graphic block that has a color fill.

Add the underlayer's spot color#

Here we instantiate a spot color with the known name of the ink the printer should use for the underlayer. The visual color approximation is not so important, so long as the name matches what the printer expects.

Exporting with an underlayer#

We enable the automatic generation of an underlayer on export with the option exportPdfWithUnderlayer = true. We specify the ink to use with underlayerSpotColorName = 'RDG_WHITE'. In this instance, we make the underlayer a bit smaller than our design so we specify an offset of 2 design units (e.g. millimeters) with underlayerOffset = -2.0.