Skip to content

Commit

Permalink
fix: apply useSystemFonts: true by default
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Nov 9, 2023
1 parent 61fb4f8 commit 02afd71
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ async function createIsomorphicCanvasFactory(
canvas.width = width;
canvas.height = height;
return canvas;
} else if (isNode) {
}

if (isNode) {
if (!_canvas) {
throw new Error('Failed to resolve "canvas" package.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/pdfjs-serverless/rollup/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Plugin } from "rollup";

export function pdfjsTypes(): Plugin {
return {
name: "pdfjs:types",
name: "pdfjs-serverless:types",
async writeBundle() {
const data = `
import * as PDFJS from './types/src/pdf'
Expand Down
3 changes: 3 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const isBrowser = typeof window !== "undefined";
*
* Applies the following defaults:
* - `isEvalSupported: false`
* - `useSystemFonts: true`
*/
export async function getDocumentProxy(
data: BinaryData,
Expand All @@ -24,6 +25,8 @@ export async function getDocumentProxy(
const pdf = await getDocument({
data,
isEvalSupported: false,
// See: https://github.com/mozilla/pdf.js/issues/4244#issuecomment-1479534301
useSystemFonts: true,
...options,
}).promise;

Expand Down

0 comments on commit 02afd71

Please # to comment.