Skip to content
DemoSampleAPI ReferenceFAQ

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Other PDF Standards ​

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

StandardDescriptionformattypenumpartType
PDF/X-1aPrint exchange standard. Only CMYK and spot colors are allowed.CPDFStandardFormatPDFX1CPDFPartTypeNone
PDF/X-3Print exchange standard. Allows RGB colors managed by an ICC profile.CPDFStandardFormatPDFX3CPDFPartTypeNone
PDF/X-4Print exchange standard. Allows transparency and layers.CPDFStandardFormatPDFX4CPDFPartTypeNone
PDF/E-1Engineering document standard.CPDFStandardFormatPDFE1CPDFPartTypeNone
PDF/UA-1Universal accessibility standard. Requires a CPDFUAConfig.CPDFStandardFormatPDFUA1CPDFPartTypeNone
PDF/VT-1Variable data and transactional printing standard.CPDFStandardFormatPDFVT1CPDFPartTypeNone
PDF/VT-2Variable data and transactional printing standard.CPDFStandardFormatPDFVT2CPDFPartTypeNone

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:

swift
// 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 ?? "")")
}
objective-c
// 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:

swift
// 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 ?? "")")
}
objective-c
// 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.