Xojo Conferences
XDCMay2019MiamiUSA
MBSOct2019CologneDE

DynaPDF Manual - Page 179

Previous Page 178   Index   Next Page 180

Function Reference
Page 179 of 766
pdfImportPDFFile(PDF, 1, 1.0, 1.0);
switch(pdfCheckConformance(PDF, ctPDFA_1b_2005, coDefault,
PDF, // We need the instance pointer in the callback functions
pdf_OnFontNotFount,
pdf_OnReplaceICCProfile))
{
case 1: pdfAddRenderingIntent(PDF, m_RGBProfile); break;
case 2: pdfAddRenderingIntent(PDF, m_CMYKProfile); break;
case 3: pdfAddRenderingIntent(PDF, m_GrayProfile); break;
default: break;
}
// Still a PDF file in memory?
if (pdfHaveOpenDoc(PDF))
{
if (!pdfOpenOutputFile(PDF, OutFileName))
{
pdfFreePDF(PDF);
return -2;
}
pdfCloseFile(PDF);
}
TPDFError msg;
msg.StructSize = sizeof(msg);
SI32 e, errMsgCount = pdfGetErrLogMessageCount(PDF);
for (e = 0; e < errMsgCount; e++)
{
pdfGetErrLogMessage(PDF, e, &msg);
printf("Error: %s\n", msg.Message);
}
return 0;
}
int main(int argc, char* argv[])
{
// Process as many files as possible with one instance
void* pdf = pdfNewPDF();
if (!pdf) return -3; // Out of memory?
pdfSetOnErrorProc(pdf, NULL, PDFError);
pdfSetLicenseKey(pdf, "...");
// Not required but strongly recommended. External CMaps should be available when converting
// imported PDF files. The files are only loaded if necessary.
// Use an absolute path if possible! Otherwise the CMaps cannot be loaded if the working directory
// was changed.
pdfSetCMapDir("c:/MyAppPath/Resource/CMap/", TLoadCMapFlags(lcmDelayed | lcmRecursive));
SI32 retval = PDFToPDFA(pdf, "c:/test.pdf", "c:/cppout.pdf");
pdfDeletePDF(pdf);
return retval;
}
 

Previous topic: Return values

Next topic: CheckFieldNames