examples/activex_cpp/convert_conformance/convert_conformance.cpp
40 lines
// ============================================================================
// convert_conformance -- C++ ActiveX (COM) port, following
// examples/activex/convert_conformance/convert_conformance.vbs
//
// Converts a plain PDF to PDF/A and then to PDF/X, each with a single
// ConvertFile call. Both need output intents, which is why an sRGB and an
// ISOcoated CMYK profile are passed -- a conformance conversion without them
// would fail validation even though the call succeeds.
// ============================================================================
#import "..\\..\\wrappers\\activex\\LumasPdfAX.tlb" no_namespace named_guids
#include <windows.h>
#include "axcommon.h"
#include <cstdio>
int main() {
ChdirToExe();
ComInit com;
if (!com.ok()) return 1;
ILumasPDFPtr pdf;
if (FAILED(pdf.CreateInstance(L"LumasPdf.PDF"))) return 1;
// sRGB + ISOcoated CMYK profiles embedded
long a = pdf->ConvertFile(B("../../test_files/plain.pdf"), B("out_pdfa.pdf"),
ctPDFA_2b, 0,
B("../../test_files/sRGB.icc"),
B("../../test_files/ISOcoated_v2_bas.ICC"), B(""));
std::printf("plain -> PDF/A (ctPDFA_2b) rc=%ld\n", a);
long x = pdf->ConvertFile(B("../../test_files/plain.pdf"), B("out_pdfx.pdf"),
ctPDFX_4, 0,
B("../../test_files/sRGB.icc"),
B("../../test_files/ISOcoated_v2_bas.ICC"), B(""));
std::printf("plain -> PDF/X (ctPDFX_4) rc=%ld\n", x);
return 0;
}
This file is in the SDK at examples/activex_cpp/convert_conformance/convert_conformance.cpp.
The build fails if this page and that file ever differ.