Pdf.js: Font not displaying characters properly (standard char set)

Created on 2 Jun 2017  Â·  9Comments  Â·  Source: mozilla/pdf.js

Link to PDF file (or attach file here): https://www.ordinate.buzz/sample.pdf

Configuration:

  • Web browser and its version: Issue occurs on FF and Chrome. Works on IE
  • Operating system and its version: Windows 10
  • PDF.js version: //mozilla.github.io/pdf.js/build/pdf.js
  • Is an extension:

Steps to reproduce the problem:
My code (standard code pasted from samples) is below. The file displays 'normally' in a PDF viewer, but with PDF.JS on Chrome/Firefox, it doesn't.

What went wrong?

Various letters of the font in the top line of text don't get rendered properly. The font in question is called 'GE Inspira Sans'

See Screenshot.

capture

4-font-conversion 4-font-opentype

Most helpful comment

@hamble The argument "but it displays on ....." comes up all the time. It works on some (not all - I have two where it doesn't) viewers because the devs put a lot of effort to be lenient on bad PDFs. Nevertheless, your PDF is incorrect. The best thing would be to tell the problem to Bytescout PDFSDK and/or use a truetype font.

All 9 comments

I can reproduce this using Firefox 53.0.3 on Arch Linux with the latest PDF.js development add-on.

Hi @Snuffleupagus - do you have any advice on this one? Hoping to have this working next week :) Any help is much appreciated!

Hi @Snuffleupagus - do you have any advice on this one? Hoping to have this working next week :) Any help is much appreciated!

I've only looked briefly, and concluded that it's related to how we detect OpenType fonts, but haven't had time to look into a possible solution yet.
When making changes to the font code in PDF.js, it's possible to cause regressions elsewhere, which often makes fixing font bugs time consuming. When it comes to OpenType in particular, we've had a number of issues/regressions in the relevant code, which means that testing a potential solution takes some time.

Since I'm not paid to work on PDF.js, but rather do it for "fun" in my spare time, I cannot promise a time-line for a patch.[1] I'll possibly look at this later in the week, but please do not interpret that as a guarantee!


[1] Also, please keep in mind that since PDF.js is free open-source software, giving exact time-lines for when a certain issue will be fixed can often be difficult.

@hamble did you generate this PDF yourself? The FontFile2 stream must be "A stream containing a TrueType font program". Yours isn't, it is an OpenType font containing CFF data. See "Embedded font organization for various font types" in the PDF specification.

I generated it using Bytescout PDFSDK. It opens and displays correctly in various PDF viewers, and within the browsers themselves, and indeed in IE within PDF.JS.

@Snuffleupagus - yes of course, completely understand! Your efforts are much appreciated :)

@hamble The argument "but it displays on ....." comes up all the time. It works on some (not all - I have two where it doesn't) viewers because the devs put a lot of effort to be lenient on bad PDFs. Nevertheless, your PDF is incorrect. The best thing would be to tell the problem to Bytescout PDFSDK and/or use a truetype font.

Thanks for info. I have contacted them.


From: Tilman Hausherr notifications@github.com
Sent: Thursday, June 8, 2017 1:38:02 PM
To: mozilla/pdf.js
Cc: hamble; Mention
Subject: Re: [mozilla/pdf.js] Font not displaying characters properly (standard char set) (#8480)

@hamblehttps://github.com/hamble The argument "but it displays on ....." comes up all the time. It works on some (not all - I have two where it doesn't) viewers because the devs put a lot of effort to be lenient on bad PDFs. Nevertheless, your PDF is incorrect. The best thing would be to tell the problem to Bytescout PDFSDK and/or use a truetype font.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/mozilla/pdf.js/issues/8480#issuecomment-307090378, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ANO9LTrG9Y63uoqeon29_SBgf0kx09L6ks5sB-sqgaJpZM4NuhKL.

An online OTF-TTF converter resolves the problem. Thanks both for your advice.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandonros picture brandonros  Â·  3Comments

BrennanDuffey picture BrennanDuffey  Â·  3Comments

anggikolo11 picture anggikolo11  Â·  3Comments

SehyunPark picture SehyunPark  Â·  3Comments

dmisdm picture dmisdm  Â·  3Comments