Can't create blank PDF - 'PDFWorkerError'

I am unsuccessful in creating a bank pdf as demonstrated in Audrey’s video “How to generate PDF with PDFTron PDFNet Node.js SDK - YouTube”.

[Ubuntu 22.10, Nodejs v18.13.0]

// index.js
const { PDFNet } = require(“@pdftron/pdfnet-node”);

const main = async () => {
const doc = await PDFNet.PDFDoc.create();
const page = await doc.pageCreate();
doc.pagePushBack(page);
doc.save(“blank.pdf”, PDFNet.PDFDoc.SaveOptions.e_linearized);
};
PDFNet.runWithCleanup(
main,
“key”
)
.catch((err) => {
console.log(err);
})
.then(() => {
PDFNet.shutdown();
});

// package.json
{
“name”: “tron”,
“version”: “1.0.0”,
“description”: “”,
“main”: “index.js”,
“scripts”: {
“test”: “echo "Error: no test specified" && exit 1”
},
“keywords”: [],
“author”: “”,
“license”: “ISC”,
“dependencies”: {
@pdftron/pdfnet-node”: “^9.4.2”
}
}

// terminal output
PDFNet is running in demo mode.
{
message: ‘Exception: \n’ +
‘\t Message: locale::facet::_S_create_c_locale name not valid\n’ +
‘\t Conditional expression: \n’ +
‘\t Version : 9.4.2-a2633dd\n’ +
‘\t Platform : Linux\n’ +
‘\t Architecture : AMD64\n’ +
‘\t Filename : \n’ +
‘\t Function : \n’ +
‘\t Linenumber : 0\n’,
type: ‘PDFWorkerError’
}

This appears to be an environment configuration issue with your Ubuntu instance, and updating locales in your instance are how to resolve this.

I suspect something like the following will help you.
https://help.ubuntu.com/community/Locale

For example the following worked for another user.

Change the env var by export LC_ALL=C; unset LANGUAGE