Using TypeScript#
If you are using TypeScript for your development you should create a tsconfig.json file at the root of your project with the minimal configuration:
{
"compilerOptions": {
"module": "nodenext"
}
}
To ensure you can work with the
mupdfmodule either work withmtsfiles in TypeScript or usetsfiles and add to yourpackage.jsonthe following:
"type": "module"
When compiling the TypeScript to JavaScript use the following to trigger the compiler:
tsc
IDE auto-completion#
If using Visual Studio Code the MuPDF TypeScript API (derived from node_modules/mupdf/dist/mupdf.d.ts) should be exposed for your use and IDE code prompts will suggest available methods against mupdf objects.