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

Black text not visible on page in PDF #5291

Closed
ccisoc opened this issue Sep 12, 2014 · 8 comments
Closed

Black text not visible on page in PDF #5291

ccisoc opened this issue Sep 12, 2014 · 8 comments

Comments

@ccisoc
Copy link

ccisoc commented Sep 12, 2014

We have a PDF produced by our own application through our own pdf implementation. If we open a PDF with text using PDF.js the text is not visible. When I inspect the page I can see the text is present in the page source, but not present in the page view.

The same PDF does not have any issues in Adobe Acrobat, Apple Preview, Artifex Ghostscript, printers and RIPs. I tested it with newest version of of Firefox 32.0. It was also present in firefox 25.

Pdf is available here:
http://docdroid.net/hhoq

Screenshot of PDF open in Adobe Reader:
screen shot 2014-09-12 at 13 49 06

@yurydelendik
Copy link
Contributor

Looking at the page content font size is set to 56234:

/F1 56234 Tf
100.000000 Tz
1.000000 0 0.000000 1.000000 537581 2550414 Tm 
1 Tw [(T) 89 (es) 19 (t T) 89 (e) 39 (xt)] TJ

We probably shall specify the max limit to the font size we use for canvas painting, similar with what we do for min font size.

@yurydelendik
Copy link
Contributor

https://github.com/mozilla/pdf.js/blob/master/src/display/canvas.js#L28

Setting as a starter bug, just to verify if capping the font size to some reasonable number e.g. 64 will fix the issue.

@ccisoc
Copy link
Author

ccisoc commented Sep 12, 2014

You should look at bit more on the pdf. We do not use 1/72 inches as our units. We use 1/10000 mm because we need that preciseness. Hence at the start of the pdf we translate all units to this:

0.000283465 0 0 0.000283465 0 0 cm

That 56234 is translated to a normal font size of 16.

@yurydelendik
Copy link
Contributor

Right, during painting to canvas we are trying to use the original font size e.g. ctx.fontStyle = "56234px f1"; in your case. We adjust the font size for really small fonts atm, but we should do that for really big fonts as well.

@ccisoc
Copy link
Author

ccisoc commented Sep 12, 2014

Arh okay. Will see if you are able to fix the bug.

@yurydelendik
Copy link
Contributor

@ccisoc are you author of this PDF? can we use it in our reference tests?

thejdeep added a commit to thejdeep/pdf.js that referenced this issue Oct 14, 2014
thejdeep added a commit to thejdeep/pdf.js that referenced this issue Oct 14, 2014
thejdeep added a commit to thejdeep/pdf.js that referenced this issue Oct 14, 2014
Issue mozilla#5291 black text not visible

Optimized code
thejdeep added a commit to thejdeep/pdf.js that referenced this issue Oct 14, 2014
Issue mozilla#5291 black text not visible

Optimized code

Lint error fix
@ccisoc
Copy link
Author

ccisoc commented Oct 15, 2014

@yurydelendik Yes you can say i am the author of the PDF. Unfortunately we embed a font from Ghostscript in the PDF which i do not know if we are allowed to distribute to other people than our customers and their customers. So on the grounds that i do not want to go through legal i'dd rather say no.

But i'll try to see if I can produce a similar PDF without an embedded font for you to use in reference tests.

thejdeep added a commit to thejdeep/pdf.js that referenced this issue Oct 22, 2014
Issue mozilla#5291 black text not visible

Optimized code

Lint error fix

Fixed fontSizeScale issue
thejdeep added a commit to thejdeep/pdf.js that referenced this issue Oct 22, 2014
Issue mozilla#5291 black text not visible

Optimized code

Lint error fix

Removed trailing spaces
thejdeep added a commit to thejdeep/pdf.js that referenced this issue Oct 22, 2014
Black text not visible mozilla#5291

Issue mozilla#5291 black text not visible

Optimized code

Lint error fix

Removed trailing spaces
@Snuffleupagus
Copy link
Collaborator

@ccisoc I've created a reduced test case for this issue, see PR #5443.

yurydelendik added a commit that referenced this issue Oct 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants