Skip to content

Commit

Permalink
address issue with missing fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
deathemperor authored Nov 14, 2023
1 parent db38341 commit 2af2b33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pdf-img-convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Canvas = require("canvas");
const assert = require("assert").strict;
const fs = require("fs");
const util = require('util');
const path = require('path');

const readFile = util.promisify(fs.readFile);

Expand Down Expand Up @@ -96,8 +97,10 @@ module.exports.convert = async function (pdf, conversion_config = {}) {
// At this point, we want to convert the pdf data into a 2D array representing
// the images (indexed like array[page][pixel])

var packagePath = path.dirname(require.resolve("pdfjs-dist/package.json"));

var outputPages = [];
var loadingTask = pdfjs.getDocument({data: pdfData, disableFontFace: true, verbosity: 0});
var loadingTask = pdfjs.getDocument({data: pdfData, disableFontFace: true, verbosity: 0, standardFontDataUrl: packagePath + '/standard_fonts/'});

var pdfDocument = await loadingTask.promise

Expand Down

0 comments on commit 2af2b33

Please sign in to comment.