You can install the exiftool
command line utility to edit the metadata of PDFs:
sudo apt install libimage-exiftool-perl
Then you can use the Node.js child_process.exec()
function to call the command line utility from your program:
'use strict';
const exec = require('util').promisify(require('child_process').exec);
const execute = async command => {
const {stdout, stderr} = await exec(command);
console.log((stderr || stdout).trim());
};
(async () => {
await execute('exiftool -title="Example PDF" -author="John Doe" /var/www/example.com/public_html/example.pdf');
})();