mPDF Manual – mPDF Variables

restrictColorSpace

(mPDF ≥ 5.1)

restrictColorSpace – Specify whether to automatically limit the colorspaces used

Description

void PDFAauto

Specify whether to automatically limit the colorspaces used when creating PDF/A1-b or PDF/X-1a compliant documents. PDF files can contain objects using different colorSpaces e.g. Grayscale, RGB and CMYK. By default, mPDF creates PDF files using the colours as they are specified: font colour may be set (e.g. #880000) as an RGB colour, and the file may contain JPG images in RGB or CMYK format.

In some circumstances, you may wish to create a PDF file with restricted colorSpaces e.g. printers will often want files which contain only CMYK, spot colours, or grayscale, but not RGB. Using restrictColorSpace will attempt to convert every colour value used in the document to the permitted colorSpace(s). Almost everything including images will be converted (except BMP images), and the conversion of images may take significant time.

Values

$restrictColorSpace1|2|3

Values

  • 1: allow GRAYSCALE only [convert CMYK/RGB->gray]
  • 2: allow RGB / SPOT COLOR / Grayscale [convert CMYK->RGB]
  • 3: allow CMYK / SPOT COLOR / Grayscale [convert RGB->CMYK]
  • 0 or any other value: no restriction is made on colorspace used

Default: 0

Changelog

Version Description
5.1 Variable was added.

See Also

  • PDF/A1-b compliance
  • PDF/X-1a compliance
  • PDFA - Create PDF/A1-b compliant document
  • PDFX - Create PDF/X-1a compliant document
  • PDFAauto - Specify whether to automatically fix issues to create PDF/A1-b compliant document
  • PDFXauto - Specify whether to automatically fix issues to create PDF/X-1a compliant document
  • ICCProfile - Specify the ICC profile for the chosen colorspace used in the document
Fork me on GitHub