PDFTron is now Apryse. Same great products, new name.
By Apryse | 2018 Dec 11
5 min
Tags
tutorial
pdf/a
conversion
It is possible to convert from PDF to PDF/A in multiple different ways, using many different solutions. If you’re interested in converting a small number of PDF files to PDF/A, look no further than Apryse’s free online PDF/A converter tool.
If you’re interested in learning how to integrate PDF to PDF/A conversion functionality into a workflow or an application in an enterprise or archival setting, Apryse offers a PDF/A Library, including a command-line tool, which can be used to enable PDF/A conversion on Windows, Linux or MacOS devices, server-side and client-side—and even via a browser!
Start by downloading a trial of the Apryse PDF/A Library, which includes the veraPDF-tested PDF/A Converter Command-Line tool, able to convert 20+ file formats to any of the PDF/A variants.
You can read about the different PDF/A versions.
To get started on embedding Apryse’s SDK PDF/A conversion features into a desktop, mobile or web application, we offer code samples in any of the major programming languages:
Once you’re ready to begin converting files, you will need to configure your solution to convert to your desired PDF/A standard (PDF/A-1, -2 or -3) and associated PDF/A conformance level (a, b and u). For most applications and where you are not constrained by a policy, we recommend picking PDF/A-2b.
With the command-line tool, PDF/A Manager, you can easily convert files to PDF/A-2b by copy-pasting the following into the prompt.
# command line
pdfa --outdir output-folder --level 2B --convert --linearize path_to_your_pdf_file
You can also validate a PDF (before or after conversion) against 2B with the following:
# command line
pdfa --outdir output-folder --level 2B path_to_your_pdf_file
Using JavaScript & WebAssembly, Apryse even makes it possible to convert to and validate PDF/A purely client-side via a browser. Samples and test files are available as follows, with the PDF/A conversion sample appended below:
//---------------------------------------------------------------------------------------
// Copyright (c) 2001-2014 by PDFTron Systems Inc. All Rights Reserved.
// Consult legal.txt regarding legal and license information.
//---------------------------------------------------------------------------------------
(function(exports) {
'use strict';
exports.runPDFA = function() {
function* main() {
try {
console.log('PDFA validation test begins.');
var input_url = '../TestFiles/';
var input_filename = 'newsletter.pdf';
var convert = false;
var pwd = '';
var exceptions;
var max_ref_objs = 10;
var first_stop = false;
var url = input_url + input_filename;
var pdfa = yield PDFNet.PDFACompliance.createFromUrl(convert, url, pwd, PDFNet.PDFACompliance.Conformance.e_Level1B, exceptions, max_ref_objs, first_stop);
var error_count = yield pdfa.getErrorCount();
if (error_count === 0) {
console.log(input_filename + ' is a valid PDFA.');
} else {
console.log(input_filename + ' is NOT a valid PDFA.');
for (var i = 0; i < error_count; i++) {
var error_code = yield pdfa.getError(i);
var error_msg = yield PDFNet.PDFACompliance.getPDFAErrorMessage(error_code);
var num_refs = yield pdfa.getRefObjCount(error_code);
if (num_refs > 0) {
var objs = [];
for (var j = 0; j < num_refs; j++) {
var obj_ref = yield pdfa.getRefObj(error_code, j);
objs.push(obj_ref);
}
console.log('Error:' + error_msg + '. Objects:' + objs.toString());
}
}
}
} catch (err) {
console.log(err);
}
try {
console.log('PDFA conversion test begins.');
var input_url = '../TestFiles/';
var input_filename = 'fish.pdf';
var output_filename = 'fish_pdfa.pdf';
var convert = true;
var pwd = '';
var exceptions;
var max_ref_objs = 10;
var url_input = input_url + input_filename;
console.log('Converting input document: ' + input_filename);
var pdfa = yield PDFNet.PDFACompliance.createFromUrl(convert, url_input, pwd, PDFNet.PDFACompliance.Conformance.e_Level1B, exceptions, max_ref_objs);
var error_count = yield pdfa.getErrorCount();
if (error_count === 0) {
console.log(input_filename + ' is a valid PDFA.');
} else {
console.log(input_filename + ' is NOT a valid PDFA.');
}
console.log('Save and validate the converted document: ' + output_filename);
var linearize = true;
var doc_buffer = yield pdfa.saveAsFromBuffer(linearize);
saveBufferAsPDFDoc(doc_buffer, output_filename);
var validate_only = false;
var pdfa_validate = yield PDFNet.PDFACompliance.createFromBuffer(validate_only, doc_buffer, pwd, PDFNet.PDFACompliance.Conformance.e_Level1B, exceptions, max_ref_objs);
var error_count_validate = yield pdfa_validate.getErrorCount();
if (error_count_validate === 0) {
console.log(output_filename + ' is a valid PDFA.');
} else {
console.log(output_filename + ' is NOT a valid PDFA.');
}
} catch (err) {
console.log(err);
}
}
PDFNet.runGeneratorWithCleanup(main(), window.sampleL); // replace with your own license key and remove the license-key.js script tag
};
})(window);
// eslint-disable-next-line spaced-comment
//# sourceURL=PDFATest.js
When you run the Apryse PDF/A converter feature using any of the above solutions, Apryse checks if your PDF file is compliant with the PDF/A (ISO 19005) standard and converts your PDF file to a PDF/A compliant document. In so doing, the converter does a deep dive into your file to parse its contents. It then performs only the light-touch edits necessary to fix any violations it encounters, and without taking any shortcuts that could impact the original interactivity or accessibility of your files, such as rasterizing vector information into an image.
The Apryse PDF/A converter will preserve tags, logical structure and color information present in the input PDF files, while enabling you to configure the solution to add or exclude certain criteria. And at the end of the conversion process, you will get a detailed report listing any issues the converter encountered and issues the converter fixed, including any corrected or outstanding PDF/A violations and their associated PDF object(s).
In most cases, and assuming you have chosen a reasonable PDF/A standard and conformance level, your files will convert automatically and without any issues. However, before or after conversion, you may want to inspect and possibly edit a PDF object manually.
You can achieve this with Apryse’s demo CosEdit tool.
In the image below, we’ve juxtaposed a Apryse PDF/A converter command-line tool output report (on the left) with the CosEdit window (on the right).
The current PDF object under inspection in CosEdit has been given yellow highlights where it appears in both windows. You can see that the file passed conversion and re-validation without any outstanding issues. But were an error to appear, it would do so within the “PDF/A Revalidation Results (After Conversion)” section.
The new output file (license_pdfa.pdf) is accessible through the link at the bottom of the output report. Whereas the original file (license.pdf) is preserved and can be accessed through a link at the top.
For more answers to your PDF/A-related questions, be sure to check out our complete PDF/A guide!
Tags
tutorial
pdf/a
conversion
Apryse
Related Products
PDF/A Solutions
Share this post
Popular Content