XCPD Manual (Part 3b)

The XCPD Color Management API

PDF Rendering Overview

The XCPDCM API is able render a spool-ready PDF file by way of a call to the xcpdCM_setSpoolPdf() function.  It is required that the XCPD CM object contain a PDF file set prior to using this (by way of xcpdCM_setPdfFile()).

It’s important to note that the PDF file loaded in the xcpd_cm_t* object will be modified accordingly, so it is necessary to load a copy of the PDF file for rendering purposes.

Internally, the rendering is done by way of the XCPDCM renderer module.  It follows the proposed “pre-flight” workflow of checking for a PDF OutputIntent, tagging the PDF with an ICC Colorspace, and embedding a possible profile set by a user – much of this is invisible to the dialog programmer.

The argument required is the address of a xcpd_cm_t* object, while an optional xcpdcm_rstatus_t enumeration value is returned:

int error = xcpdCM_setPdfFile("myPdf.pdf", cm_obj);

if(!error) {
  xcpdcm_rstatus_t render_status;
  render_status = xcpdCM_setSpoolPdf(cm_obj);

The renderer status value will depend on the contents of the PDF file and whether or not the user has chosen a profile in the dialog.  The latter case requires a prior call to xcpdCM_setProfile()  or   xcpdCM_setProfileFromPPD() (which will be outlined in the final part of the API manual).  The enumerations that are returned can include the following:

XCPDCM_PDF_OUTPUTINTENT_EXISTS (PDF already has an OutputIntent.)

XCPDCM_PDF_COLORSPACE_SET (Colorspace has been tagged with an Assumed profile.)

XCPDCM_PDF_NEWPROFILE_EMBEDDED (A user-selected profile has been embedded into the PDF.)


In all but the final case,  a flag will be set in the XCPD CM object to indicate that the spool file is ready.  This can directly be checked by way of the  xcpdCM_isPDFReady() function:


 puts("Error: PDF file has not been properly rendered!");

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s