I have to generate a PDF/A-3 file for a Node.js project. I want to either be able to generate a PDF/A-3 file from scratch or convert an existing file to PDF/A-3.
I haven’t found a simple/straightforward way to do that so far.
I have checked libraries like pdfkit, jsPDF, pdf-lib etc… But they don’t seem to provide a simple interface to get PDF/A-3 files.
I have also tried directly modifying the PDF metadata with pdfkit by following an example tagged in this github issue, but the pdf I get does not pass PDF/A compliance tests.
Some paying libraries like pspdfkit and apryse seem to have utilities to do that, but they’re not free.
2
Answers
Welcome to Stackoverflow Charles,
try the following code:
If this helps please up-vote it and accept the answer.
Use
npm install pdf-lib
Now, create a Node.js script and use the pdf-lib library to generate the PDF/A file: