question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OTF fonts don't show up on printed page

See original GitHub issue

Even when the generated PDF looks good on the computer, if you try and print any OTF fonts to paper they don’t show up in the print out. See below for details:

const fs = require('fs');
const pdf = require('pdfjs');
const helvetica = new pdf.Font(require('pdfjs/font/helvetica.json'));
const openSans = new pdf.Font(fs.readFileSync('node_modules/pdfjs/test/fixtures/font/opensans/bold.ttf'));

const doc = new pdf.Document({ font: helvetica, padding: 10 });
doc.pipe(fs.createWriteStream('output.pdf'));

// This prints "hello good bye"
doc.text().add('hello good bye');

// This prints "              "
doc.text().add('hello good bye', { font: openSans });

// This prints "hello good bye"
doc.text().add('hello').add('good bye');

// This prints "              "
doc.text().add('hello', { font: openSans }).add('good bye', { font: openSans });

// This prints "hello         "
doc.text().add('hello').add('good bye', { font: openSans });

// This prints "      good bye"
doc.text().add('hello', { font: openSans }).add('good bye');

doc.end();

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
rkusacommented, Mar 22, 2018

What a bug - found some applications that print empty pages as reported but also applications that print correctly 😱

So much for PDFs are WYSIWYG. Definitely something that needs to be fixed (also for my own use of the library). Thanks for reporting!

0reactions
rkusacommented, Mar 26, 2018

I have set the PDF version to 1.6 for now. I’ll will publish a new NPM version later today. Thanks again for reporting this issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

I cannot print downloaded OTF Font - Microsoft Community
The font appears on my Word doc, but when I go to print it does not show up as that font, but a...
Read more >
Unable to print OTF on Windows 10 · Issue #142 - GitHub
This turns out to be an issue with Windows 10 Type 4 printer drivers and OTF fonts (all OTFs, not just Source Sans)....
Read more >
Printer not printing when particular TTF/OTF fonts are used
Go to devices and printers. · Right-click on the printer · ->Then go to Printer Properties · ->Preference · ->Advanced tab · ->...
Read more >
What to do when Windows won't allow some fonts to install.
Start by clicking on the start button, then on settings, then on personalization and then on fonts. In the window that appears, drag...
Read more >
Printing with my custom fonts is not working - Stack Overflow
I have a doubt about being able to print using fontFace ? try to set another safe font and see if it works....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found