Convert PDF/x to PDF formats in Python
Contents
[
Hide
]
PDF/x to PDF format means the ability to convert PDF/UA, and PDF/A to PDF file.
Convert PDF/A to PDF
- Load the PDF document using ‘ap.Document’.
- Call ‘remove_pdfa_compliance()’ to strip all PDF/A-related compliance settings and metadata.
- Save the resulting PDF to the output path.
from os import path
import aspose.pdf as ap
path_infile = path.join(self.data_dir, infile)
path_outfile = path.join(self.data_dir, "python", outfile)
document = ap.Document(path_infile)
document.remove_pdfa_compliance()
document.save(path_outfile)
print(infile + " converted into " + outfile)
Removing PDF/UA compliance
This function demonstrates a two-step conversion process: first removing PDF/UA (Universal Accessibility) compliance, and then converting the resulting PDF into PDF/A-1B format with automatic tagging for accessibility and semantic structure.
- Load the PDF document using ‘ap.Document()’.
- Call ‘document.remove_pdfa_compliance()’ to remove any PDF/A restrictions or compliance settings.
- Save the modified PDF to ‘path_outfile’.
from os import path
import aspose.pdf as ap
path_infile = path.join(self.data_dir, infile)
path_outfile = path.join(self.data_dir, "python", outfile)
document = ap.Document(path_infile)
document.remove_pdfa_compliance()
document.save(path_outfile)
print(infile + " converted into " + outfile)