Xojo Conferences

DynaPDF Manual - Page 59

Previous Page 58   Index   Next Page 60

PDF/A and PDF/AX Compatibility
Page 59 of 750
int main(int argc, char* argv[])
SI32 retval;
char outFile[] = "c:/cppout.pdf";
void* pdf = pdfNewPDF();
if (!pdf) return 2; // Out of memory?
pdfSetOnErrorProc(pdf, NULL, PDFError);
pdfCreateNewPDF(pdf, NULL); // The output file is opened later
// The font must be embedded (this should always be the case).
pdfSetFont(pdf, "Arial", fsItalic, 20.0, true, cp1252);
pdfWriteFText(pdf, taCenter, "A very simple PDF/A 1b file...");
// Check whether the file is compatible to PDF/A 1b
retval = pdfCheckConformance(pdf,ctPDFA_1b_2005,0,NULL,NULL,NULL);
case 1: pdfAddRenderingIntent(pdf,"sRGB.icc"); break; // RGB
case 2: pdfAddRenderingIntent(pdf,"CMYK.icc"); break; // CMYK
case 3: pdfAddRenderingIntent(pdf,"sRGB.icc"); break; // Gray
default: break;
// Note: CheckConformance() raises a fatal exception if the file
// cannot be converted to PDF/A 1b. We check first whether a PDF
// file is still in memory before we try to open the output file.
if (pdfHaveOpenDoc(pdf))
if (!pdfOpenOutputFile(pdf, outFile))
return -1;
retval = pdfCloseFile(pdf);
return retval;
DeviceGray is the only device color space that can be combined with RGB or CMYK color
spaces. Because special DeviceGray ICC color profiles are rarely available you can safely use a
RGB or CMYK ICC profile instead.

Previous topic: PDF/A

Next topic: Nonzero Winding Number Rule