PDF Generation Template Editor
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.
In addition to PDF/A, ComPDF SDK supports converting documents to the PDF/X, PDF/E, PDF/UA, and PDF/VT standards. The conversion works the same way as PDF/A: call writeStandardPDFToFilePath:withType:iccFilePath:withUAConfig:isSaveFontSubset:error: and specify the target standard with CPDFStandardMode.
Supported Standards
| Standard | Description | format | typenum | partType |
|---|---|---|---|---|
| PDF/X-1a | Print exchange standard. Only CMYK and spot colors are allowed. | CPDFStandardFormatPDFX | 1 | CPDFPartTypeNone |
| PDF/X-3 | Print exchange standard. Allows RGB colors managed by an ICC profile. | CPDFStandardFormatPDFX | 3 | CPDFPartTypeNone |
| PDF/X-4 | Print exchange standard. Allows transparency and layers. | CPDFStandardFormatPDFX | 4 | CPDFPartTypeNone |
| PDF/E-1 | Engineering document standard. | CPDFStandardFormatPDFE | 1 | CPDFPartTypeNone |
| PDF/UA-1 | Universal accessibility standard. Requires a CPDFUAConfig. | CPDFStandardFormatPDFUA | 1 | CPDFPartTypeNone |
| PDF/VT-1 | Variable data and transactional printing standard. | CPDFStandardFormatPDFVT | 1 | CPDFPartTypeNone |
| PDF/VT-2 | Variable data and transactional printing standard. | CPDFStandardFormatPDFVT | 2 | CPDFPartTypeNone |
ICC Profiles
iccFilePath is optional. When it is nil, conversion to PDF/X uses the bundled CoatedFOGRA39 profile, and conversion to other standards uses the bundled sRGB2014 profile. To use a custom profile (for example, an output profile provided by your print service), pass the path of the ICC file.
Convert to PDF/X-4
This example shows how to convert a document to PDF/X-4:
// Target standard: PDF/X-4 (PDF/X has no partType; the level is set by typenum only)
let standardMode = CPDFStandardMode()
standardMode.format = .PDFX
standardMode.typenum = 4
standardMode.partType = .none
// Path of a custom ICC profile; nil uses the bundled CoatedFOGRA39 profile
let iccPath: String? = nil
do {
try document.writeStandardPDF(toFilePath: savePath, withType: standardMode, iccFilePath: iccPath, with: nil, isSaveFontSubset: false, error: ())
} catch {
print("Conversion failed: \((error as NSError).localizedFailureReason ?? "")")
}// Target standard: PDF/X-4 (PDF/X has no partType; the level is set by typenum only)
CPDFStandardMode *standardMode = [[CPDFStandardMode alloc] init];
standardMode.format = CPDFStandardFormatPDFX;
standardMode.typenum = 4;
standardMode.partType = CPDFPartTypeNone;
// Path of a custom ICC profile; nil uses the bundled CoatedFOGRA39 profile
NSString *iccPath = nil;
NSError *error = nil;
if (![document writeStandardPDFToFilePath:savePath
withType:standardMode
iccFilePath:iccPath
withUAConfig:nil
isSaveFontSubset:NO
error:&error]) {
NSLog(@"Conversion failed: %@", error.localizedFailureReason);
}Convert to PDF/UA-1
PDF/UA requires a document title and a natural language, so you need to pass a CPDFUAConfig when converting:
title: The document title. It must not be empty, otherwise the conversion fails.lauguage: The document language, a CPDFConvertLauguage value (note that both the property name and the enum name are spelled Lauguage).This example shows how to convert a document to PDF/UA-1:
// Target standard: PDF/UA-1
let standardMode = CPDFStandardMode()
standardMode.format = .PDFUA
standardMode.typenum = 1
standardMode.partType = .none
// PDF/UA requires a document title (must not be empty) and a language
let uaConfig = CPDFUAConfig()
uaConfig.title = "ComPDF PDF/UA Sample"
uaConfig.lauguage = .EN_US
do {
try document.writeStandardPDF(toFilePath: savePath, withType: standardMode, iccFilePath: nil, with: uaConfig, isSaveFontSubset: false, error: ())
} catch {
print("Conversion failed: \((error as NSError).localizedFailureReason ?? "")")
}// Target standard: PDF/UA-1
CPDFStandardMode *standardMode = [[CPDFStandardMode alloc] init];
standardMode.format = CPDFStandardFormatPDFUA;
standardMode.typenum = 1;
standardMode.partType = CPDFPartTypeNone;
// PDF/UA requires a document title (must not be empty) and a language
CPDFUAConfig *uaConfig = [[CPDFUAConfig alloc] init];
uaConfig.title = @"ComPDF PDF/UA Sample";
uaConfig.lauguage = CPDFConvertLauguageEN_US;
NSError *error = nil;
if (![document writeStandardPDFToFilePath:savePath
withType:standardMode
iccFilePath:nil
withUAConfig:uaConfig
isSaveFontSubset:NO
error:&error]) {
NSLog(@"Conversion failed: %@", error.localizedFailureReason);
}Note: For PDF/E, only conversion to PDF/E-1 is supported. PDF/E-2 is currently supported for validation only, not for conversion.