Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

address issue with missing fonts #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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