Skip to content
This repository has been archived by the owner on Feb 28, 2019. It is now read-only.

Buggy output when opened with muPDF #47

Open
kwshi opened this issue Aug 29, 2018 · 3 comments
Open

Buggy output when opened with muPDF #47

kwshi opened this issue Aug 29, 2018 · 3 comments

Comments

@kwshi
Copy link

kwshi commented Aug 29, 2018

When an external font is embedded in the PDF, it cannot be opened in muPDF correctly:
jspdf-mupdf-font
Expected output:
jspdf-evince-font

muPDF also logs the following:

error: freetype: cannot load font: invalid stream operation
warning: ignored error when loading embedded font; attempting to load system font

The code to embed the fonts is as follows:

const pdf = new jsPDF();
pdf.addFileToVFS("Roboto-Regular.ttf", ROBOTO);
pdf.addFileToVFS("Roboto-Bold.ttf", ROBOTO_BOLD);
pdf.addFont("Roboto-Regular.ttf", "Roboto", "normal");
pdf.addFont("Roboto-Bold.ttf", "Roboto", "bold");

Here is the PDF in question:
hyperschedule-color.pdf

Other PDF viewers can open the file correctly, so this may be a problem with muPDF. On the other hand, muPDF has also been fine with opening other PDFs with embedded fonts in the past, so I think the problem is not with only muPDF. I suspect that there is some protocol that this library is not following entirely and that other PDF viewers have managed to correct for these errors in a way that muPDF hasn't.

@kwshi
Copy link
Author

kwshi commented Aug 29, 2018

This may be the same issue as #44, but it's worth pointing out that in my cases the problem is specific to muPDF and does not happen using evince or inkscape, etc.

@abisewski
Copy link

@kwshi Do you solved this problem?

Having same problem here with other font...

@kwshi
Copy link
Author

kwshi commented Feb 23, 2019

I haven't solved this problem--for now, I've only avoided it by not using custom fonts, but that's not a solution at all, only running away from the problem...

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

No branches or pull requests

2 participants