Search Docs
Loading...
Skip to content

Type Alias: ExportOptions

type ExportOptions = object;

Represents the options for exporting a design block.

Defines the possible options for exporting a design block.

  • ‘mimeType’: The MIME type of the output file.
  • ‘pngCompressionLevel’: The PNG compression level to use, when exporting to PNG.
  • ‘jpegQuality’: The JPEG quality to use when encoding to JPEG.
  • ‘webpQuality’: The WebP quality to use when encoding to WebP.
  • ‘targetWidth’: An optional target width used in conjunction with target height.
  • ‘targetHeight’: An optional target height used in conjunction with target width.
  • ‘exportPdfWithHighCompatibility’: Export the PDF document with a higher compatibility to different PDF viewers.
  • ‘exportPdfWithUnderlayer’: Export the PDF document with an underlayer.
  • ‘underlayerSpotColorName’: The name of the spot color to be used for the underlayer’s fill.
  • ‘underlayerOffset’: The adjustment in size of the shape of the underlayer.
  • ‘underlayerRenderRatio’: Resolution multiplier for the underlayer contour extraction.
  • ‘underlayerMaxError’: Curve-fit error tolerance for the underlayer contour.
  • ‘exportPdfWithCropMarks’: Draw crop marks outside the bleed on every exported PDF page.
  • ‘exportPdfWithRegistrationMarks’: Draw registration marks outside the bleed on every exported PDF page.
  • ‘printMarkOffset’: Distance from the trim to the nearest edge of any printer’s mark.
  • ‘printMarkWidth’: Stroke width of any printer’s mark.
  • ‘cropMarkLength’: Length of one crop mark line.
  • ‘abortSignal’: An abort signal that can be used to cancel the export.

Properties#

Property Type Default value Description
mimeType? ImageMimeType Exclude<ApplicationMimeType, "application/zip">
pngCompressionLevel? number 5. The PNG compression level to use, when exporting to PNG. Valid values are 0 to 9, higher means smaller, but slower. Quality is not affected. Ignored for other encodings.
jpegQuality? number 0.9 The JPEG quality to use when encoding to JPEG. Valid values are (0-1], higher means better quality. Ignored for other encodings.
webpQuality? number undefined The WebP quality to use when encoding to WebP. Valid values are (0-1], higher means better quality. WebP uses a special lossless encoding that usually produces smaller file sizes than PNG. Ignored for other encodings. Defaults to 1.0.
targetWidth? number undefined An optional target width used in conjunction with target height. If used, the block will be rendered large enough, that it fills the target size entirely while maintaining its aspect ratio.
targetHeight? number undefined An optional target height used in conjunction with target width. If used, the block will be rendered large enough, that it fills the target size entirely while maintaining its aspect ratio.
exportPdfWithHighCompatibility? boolean undefined Export the PDF document with a higher compatibility to different PDF viewers. Bitmap images and some effects like gradients will be rasterized with the DPI setting instead of embedding them directly.
exportPdfWithUnderlayer? boolean undefined Export the PDF document with an underlayer. An underlayer is generated by adding a graphics block behind the existing elements of the shape of the elements on the page.
underlayerSpotColorName? string undefined The name of the spot color to be used for the underlayer’s fill.
underlayerOffset? number undefined The adjustment in size of the shape of the underlayer.
underlayerRenderRatio? number 1.0 Resolution multiplier for the raster pass that extracts the underlayer contour. Higher values produce sharper underlayer outlines at the cost of memory and export time. Useful for small text on large pages, where the 1.0 default can miss fine glyph details. Values <= 0 fall back to 1.0. NaN / Infinity are rejected at the binding boundary with a StructError; pass a real number or leave the field undefined to use the default.
underlayerMaxError? number 2.0 Maximum acceptable curve-fit error, in pixels, when vectorising the underlayer contour. Smaller values produce tighter fits at the cost of more path complexity. Useful together with underlayerRenderRatio for small text on large pages. Values <= 0 fall back to 2.0. NaN / Infinity are rejected at the binding boundary with a StructError; pass a real number or leave the field undefined to use the default.
allowTextOverhang? boolean false If true, the export will include text bounding boxes that account for glyph overhangs. When enabled, text blocks with glyphs that extend beyond their frame (e.g., decorative fonts with swashes) will be exported with the full glyph bounds visible, preventing text clipping.
exportPdfWithDeviceCMYK? boolean false Export CMYK colors using their native color spaces in the PDF. When enabled, direct CMYK colors are written as DeviceCMYK (k/K operators) and spot colors with CMYK values (set via setSpotColorCMYK) are written as DeviceN with process CMYK components. When disabled (default), all colors are exported as DeviceRGB.
exportPdfWithCropMarks? boolean false Draw crop marks outside the bleed on every exported PDF page. Crop marks are the four pairs of corner lines that show a print shop where to cut. They are painted in the PDF registration colorant All, so they appear on every separation. This grows the PDF MediaBox to the trim plus printMarkOffset plus the larger of cropMarkLength and 15 points on each side, because the marks live outside the bleed. The page content, the TrimBox and the BleedBox keep describing the same physical rectangles. A page whose trim is not a rectangle, so a page with page/marginScale above 1, gets no marks and no larger page.
exportPdfWithRegistrationMarks? boolean false Draw registration marks outside the bleed on every exported PDF page. A registration mark is the bullseye target a press operator aligns the plates by. One sits at the middle of each page edge, and each is painted in the PDF registration colorant All, so they appear on every separation. This grows the PDF MediaBox on the same terms as exportPdfWithCropMarks, and a page whose trim is not a rectangle gets no marks either. A registration mark has one fixed size, so there is no knob for it.
printMarkOffset? number the equivalent of 6 pt Distance from the trim to the nearest edge of any printer’s mark, in design units. Every mark type shares it, so it is comparable with the page bleed without converting. A negative value falls back to the equivalent of 6 pt. 0 is a real offset that places a mark on the trim edge. A mark may reach into the bleed, which the knife removes anyway, and every mark carries a white knockout underneath so it stays legible over artwork. Only used when exportPdfWithCropMarks or exportPdfWithRegistrationMarks is true.
printMarkWidth? number 0.25 Stroke width of any printer’s mark, in points. Every mark type shares it, and a print shop calls it the weight. Points, not design units, because a stroke weight is a print measure that never meets the page geometry. The offset and the crop mark length are in design units. Values <= 0 fall back to 0.25, a hairline. Only used when exportPdfWithCropMarks or exportPdfWithRegistrationMarks is true.
cropMarkLength? number the equivalent of 15 pt Length of one crop mark line, in design units. It shares the unit of printMarkOffset, because the exported sheet grows by the sum of the two. Values <= 0 fall back to the equivalent of 15 pt. Only used when exportPdfWithCropMarks is true.
pdfImageQuality? number 1.0 The encoding quality to use for images that have to be rasterized during PDF export, e.g. images with effects or blurs applied, or any bitmap image when exportPdfWithHighCompatibility is enabled. Valid values are (0-1]. Exactly 1.0 (the default) keeps the lossless encoding, like webpQuality. Any value below 1.0 re-encodes rasterized images as lossy JPEG at the given quality, which produces much smaller files. Only rasterized content that is fully opaque can be re-encoded, because JPEG has no alpha channel. Content that keeps transparency, for example when exporting a block or a page without a background fill, stays losslessly encoded whatever this option is set to. Images whose original JPEG data is embedded directly are never re-encoded and are not affected by this option.
pdfChunkSize? number an engine-chosen size Upper bound, in bytes, for a single chunk of PDF output. Affects a PDF export only. A larger value lowers the per-chunk overhead and raises the memory each chunk costs. A smaller value does the opposite. Values outside [4096, 67108864] are clamped into that range, so an unusable request lowers the quality of the trade rather than failing the export. This is a bound and not a chunk size: the encoder also flushes after each page, so the last chunk of a page is normally smaller.
onProgress? (exportedPages, totalPages) => void undefined A callback which reports on the progress of a PDF export. Invoked after each page has been serialized into the document with the number of pages exported so far and the total number of pages. Only called for PDF exports.
abortSignal? AbortSignal undefined An abortsignal that can be used to cancel the export.