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.

PDF file not rendering properly

See original GitHub issue

Link to PDF file (or attach file here): New.pdf

Configuration:

  • Web browser and its version:Chrome Version 50.0.2661.94 (64-bit), also Safari Version 9.0.1 (11601.2.7.2)
  • Operating system and its version: Mac OS X v10.11.1
  • PDF.js version: pdfjs-1.4.20-dist, also tried pdfjs-1.5.188-dist
  • Is an extension: No

Steps to reproduce the problem: Execute in dev tools console in Chrome:

PDFJS.disableWorker = true;
PDFJS.getDocument('<url to document>').then(function(pdf){
  pdf.getPage(1).then(function(page){
    viewport = page.getViewport(1);
    canvas = document.getElementById('render-doc-here');
    context = canvas.getContext('2d');
    canvas.width = viewport.width;
    renderContext = {canvasContext: context, viewport: viewport};
    page.render(renderContext);
  })
});

What is the expected behavior? screenshot if i just load the url of pdf

What went wrong? screenshot of bad render

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): not hosted

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
richknilescommented, May 17, 2016

For future reference to others interested in using PDF.js with Ember, turning off extensions for Array appears to fix the issue of incorrect pdf rendering of some pdf files. https://guides.emberjs.com/v2.5.0/configuring-ember/disabling-prototype-extensions/

1reaction
yurydelendikcommented, May 11, 2016

Is there some documentation about CMaps? I don’t see anything about that in the examples.

See e.g. https://github.com/mozilla/pdf.js/blob/master/examples/components/simpleviewer.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot viewing PDF files on the web - Adobe Support
In Reader or Acrobat, right-click the document window, and choose Page Display Preferences. · From the list at left, select Internet. · Deselect ......
Read more >
Pdf files not rendering properly to the browser ... - MSDN
User1796588957 posted. Hello Friends,. I am stuck with one issue in my project. My problem is , I need to display pdf files...
Read more >
PDF file not rendering properly - Flexmonster
Hi Team, when we export pdf, each time it renders different. we do not see any consistent pattern, please find the attached screenshots...
Read more >
50. Why won't my LaTeX render properly in the PDF export of ...
PDFs in general can be finicky, and LaTeX is no exception to this. If your LaTeX is not displaying properly in a PDF,...
Read more >
PDFs Not Rendering Properly In Oracle Content Management
We have noticed that the output documents are not rendering correctly in OCE when viewed. The PDF's do appear to be correct when...
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