Pdf.js: set option disableFontFace

Created on 4 Jun 2018  路  5Comments  路  Source: mozilla/pdf.js

How do set the option disableFontFace to false ? It is not an option in PDFJS anymore you can see at #6742, and then im falling into #4244.

It says - "We will remove any PDFJS.xxxx properties in the future. This one is probably belong to render() parameters." So, how do it works? I wasnt able to go through with this.

Configuration:

  • Chrome 66.0.3359.181 64 bits
  • MacOS High Sierra 10.13.4
  • 2.0.489 from CDN URL;
  • No

All 5 comments

You can pass disableFontFace as a parameter to the getDocument API call. Refer to https://github.com/mozilla/pdf.js/commit/0ecc22cb04b54e57bbe0e498791f9a604c8c2e57#diff-304ad4918827181a1d1f52f5803717cdL64 for an example (note that we only removed that because we now handle this automatically for NodeJS environments, but this is the good way to pass the parameter) and https://github.com/mozilla/pdf.js/blob/master/src/display/api.js#L164 for the API documentation.

I'm doing it like

pdfjsLib.getDocument(url, { disableFontFace: true }).then(doc) => {}

but seems like nothing changed, it does not fallback, or what should I expect?

The getDocument call only expects one parameter, not two. I think it should be:

pdfjsLib.getDocument({ url, disableFontFace: true }).then(doc) => {...}

since url is also part of the DocumentInitParameters, just like disableFontFace (https://github.com/mozilla/pdf.js/blob/master/src/display/api.js#L111).

I'm fucking dumb, thanks for the help, you're right, i didnt pay attention to that

No worries, and good luck!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

azetutu picture azetutu  路  4Comments

THausherr picture THausherr  路  3Comments

brandonros picture brandonros  路  3Comments

PeterNerlich picture PeterNerlich  路  3Comments

hp011235 picture hp011235  路  4Comments