Convert PDF to PDF/A in Objective-C, Java, and C#

Tutorials | Convert · How To Fri. 30 Sep. 2022

PDF format is greatly practical and convenient, while it’s not always the best choice under certain circumstances. When it comes to the situation that a PDF file cannot be opened by the latest document processors, you can convert them to a standard format called PDF/A to ensure that your PDF files are compatible with different browsers and future applications.

 

 

What Is PDF/A?

 

PDF/A (Portable Document Format Archivable) is an ISO standard format that supports the long-term archiving of electronic documents for future use. The format sets certain restrictions and rules on the documents to achieve conformance, which ensures that the documents can be opened by any software or operating system without losing their formatting, color, hypertext, and fonts even after a long time. PDF/A is mostly used in law firms, banks, governments, and hospitals, as these types of institutions need to archive documents and save data for long-term purposes.

 

Types of PDF/A

 

There are four versions of PDF/A:

 

- PDF/A-1: PDF/A-1 is the original PDF/A standard. It is the most commonly used and the most restrictive nowadays. PDF/A-1 specifies Basic (b) and Accessible (a) levels of conformance and has standards on colors, annotations, fonts, etc.

- PDF/A-2: PDF/A-2 adds contents including JPEG 2000, transparency, layers and attachments in PDF/A. Meanwhile, Unicode (u) level of conformance is also introduced by PDF/A-2.

- PDF/A-3: PDF/A-3 is extremely similar to PDF/A-2 but allows any file type as an attachment, like XML, CSV, CAD, spreadsheet documents, word processing documents, etc.

- PDF/A-4: Instead of using the previous conformance levels a, b, and u, PDF/A-4 introduces two new conformance levels, e & f.

 

As mentioned above, apart from versions, PDF/A includes multiple conformance levels, used for different purposes.

 

- Level b (Basic) — PDF/A-1b & PDF/A-2b & PDF/A-3b: Meets all requirements and specifications of the standard. B-level conformance is the easiest level to achieve.

- Level u (Unicode) — PDF/A-2u & PDF/A-3u: Requires characters to map to Unicode to ensure reliable searching and reading of the text.

- Level a (Accessible) — PDF/A-1a & PDF/A-2a & PDF/A-3a: In addition to Basic and Unicode, Accessible adds requirements for tagging, logical structure, language specification, and natural reading order.

- Level e — PDF/A-4e: It is targeted at engineering documents and supports rich media, 3D annotations, and embedded files.

- Level f — PDF/A-4f: Allows non-PDF/A file attachments, which is similar to how PDF/A-2 is optimized to PDF/A-3.

 

Now we have learned multiple versions and levels of PDF/A. It can be inferred that PDF/A has been frequently updated, indicating that it is widely used. Let's see why it's so popular.

 

 

Advantages of PDF/A

 

- Long-Term Preservation: PDF/A is designed for reliable long-time preservation of digital documents with text, raster images, vector graphics, and associated metadata.

- Industry Acceptance: PDF/A is highly accepted by multiple industries, making PDF/A a necessary format for archiving documents. For example, the US Supreme Court ruled that documents submitted through the electronic filing system should be in PDF/A format.

- Text Searching: You can search text strings stored in the database for quick access to any specific text or information.

- Easily Accessible: PDF/A is a subset of PDF, so you can use a wide range of free PDF viewers to open and view PDF/A documents.

 

 

Convert PDF to PDF/A

 

When you need to convert PDF to PDF/A, you can use ComPDFKit to complete it. The conversion option analyzes the content of existing PDF files and performs a sequence of modifications in order to produce a PDF/A compliant document. Features that are not suitable for long-term archiving (such as encryption, obsolete compression schemes, missing fonts, or device-dependent color) are replaced with their PDF/A compliant equivalents. The following code sample shows how to convert PDF to PDF/A-1a in different programming languages.

 

Objective-C

NSURL *url = [NSURL fileURLWithPath:pdfPath];
CPDFDocument *document = [[[CPDFDocument alloc] initWithURL:url] autorelease];
[document writePDFAToURL:url withType:CPDFTypePDFA1a];

 

Java

document.convertType(PDFDocumentType.PSOPDFA1a);

 

C#

CPDFDocument document = CPDFDocument.InitWithFilePath("filePath");
document.WritePDFAToFilePath(CPDFType.CPDFTypePDFA1a,"savePath");

 

 

Conclusion

 

PDF/A and PDF are suitable for different scenarios, and they are both important. Hope the information presented in this article can help you understand PDF/A better. If you have any questions, please don’t hesitate to contact us.

Ready to Get Started?

Download our all-in-one ComPDFKit for free and run it to your project within minutes!