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

Determining when to use disableFontFace #11311

Closed
tristansokol opened this issue Nov 8, 2019 · 5 comments
Closed

Determining when to use disableFontFace #11311

tristansokol opened this issue Nov 8, 2019 · 5 comments
Labels

Comments

@tristansokol
Copy link

I'm running into issues similar to #4244 but am interested in knowing if there is a way to programmatically determine if I should use disableFontFace.

I'm attempting to OCR invoices, and some of them render correctly with disableFontFace:false and others with disableFontFace:true, if you supply a pdf the wrong disableFontFace you end up with a pdf that is void of text, or has boxes as is documented in other issues.

My question is, Is there a way to determine (via the pdfDocument metadata or any other means) if I should use the disableFontFace option when calling .getDocument()?

I have tried getting text content and looking at fonts, but I'm not sure if I can just say "oh this text content seems to be all in Helvetica, so I know that I need to use disableFontFace:true" That information and a list of system fonts seems like the only path forward based on the other issues I've read.

Thank you.

@sayo96
Copy link

sayo96 commented Dec 5, 2020

@timvandermeij is there any update on this?

@tristansokol
Copy link
Author

@sayo96 as far as I am aware there is not a way to determine which setting you need, and depending on your pdfs you may need the effects of both setting to correctly render.

@sayo96

This comment has been minimized.

@SantiagoM92

This comment has been minimized.

@Snuffleupagus
Copy link
Collaborator

After PR #12726, rendering of standard fonts should work even with disableFontFace = true set; assuming obviously that the standardFontDataUrl parameter is correctly set when calling getDocument:

pdf.js/src/display/api.js

Lines 168 to 169 in 891f21f

* @property {string} [standardFontDataUrl] - The URL where the standard font
* files are located. Include the trailing slash.

Furthermore, it should also be possible to successfully use disableFontFace = false now (i.e. the default value); possibly you may need to manually set useSystemFonts = false in that case (if you're using PDF.js in a browser).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants