Examples / convert_conformance / cpp_linux

Convert Conformance

A complete, runnable cpp_linux program — 17 lines, shipped in your download.

Demonstrates PDF/A & Conformance

Same example, other languages: activex_cpp c cpp csharp python vbnet

examples/cpp_linux/convert_conformance/convert_conformance.cpp 17 lines
// convert_conformance -- C++ port: plain PDF -> PDF/A and PDF/X, each a SINGLE method call.
#include <lumaspdf.h>
#include <cstdio>
int main(void){
  PPDF p = pdfNewPDF();
  int a = pdfConvertFileA(p, LUMAS_REPO_ROOT "/sample_pdfa.pdf", "out_pdfa.pdf",
      ctPDFA_2b, 0, LUMAS_REPO_ROOT "/sample_rgb.icc",
      NULL /* bring your own CMYK press profile */, NULL, NULL, NULL, NULL);
  printf("plain -> PDF/A (ctPDFA_2b) rc=%d\n", a);
  int x = pdfConvertFileA(p, LUMAS_REPO_ROOT "/sample_pdfa.pdf", "out_pdfx.pdf",
      ctPDFX_4, 0, LUMAS_REPO_ROOT "/sample_rgb.icc",
      NULL /* bring your own CMYK press profile */, NULL, NULL, NULL, NULL);
  printf("plain -> PDF/X (ctPDFX_4)  rc=%d\n", x);
  pdfDeletePDF(p);
  return (a < 0 || x < 0) ? 1 : 0;
}

This file is in the SDK at examples/cpp_linux/convert_conformance/convert_conformance.cpp. The build fails if this page and that file ever differ.