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.

Change code base to improve performance of PDFJS (see the issue https://github.com/mozilla/pdf.js/issues/6493)

See original GitHub issue

All,

According to the issue https://github.com/mozilla/pdf.js/issues/6493, there is a problem that relating to performance when rendering a special scanning file (CCITTFaxStream).

I used the latest version of pdf js (v1.1.469). I deployed to IIS Manager and tested it on localhost but pdf.js renders slowly. Here is detail information:

I have logged time at render function of PDF.JS as follows:

render: function PDFPageProxy_render(params) {
      var stats = this.stats;
      stats.time('Overall');
      ....
    function complete(error) {
       ...
        stats.timeEnd('Rendering');
        stats.timeEnd('Overall');

        console.log(stats.toString());
      }
}

This is logging time: Page Request: 20ms Rendering: 3284ms => Overall: 3304ms

I would like to change the code base to improve performance. I have done the following things:

  • I found that pdf.js takes long time at the function putBinaryImageData
  • I have checked the function putBinaryImageData . This function renders an image into canvas from bytes array. Because bytes array is too big (16,843,200 bytes), this function takes about 3s to render. Thus, in order to reduce the processing time, I think the solution is to scale down the input bytes array before rendering. But it is unable to do with JavaScript.

Could you possibly advise how to improve in this case?

Regards, Huy

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
timvandermeijcommented, Jan 15, 2019

The pull request above is closed; refer to https://github.com/mozilla/pdf.js/pull/7047#issuecomment-454581807 for the reasons. We’ll keep this open for tracking the issue and we can reopen/revisit the PR if the other PR does not already have enough effect for this.

0reactions
Snuffleupaguscommented, Sep 28, 2021

File for testing: https://drive.google.com/open?id=0BzoKdQwBinAnXzVJcmdVZjBmbkE

That file is no longer available, but given that https://github.com/mozilla/pdf.js/issues/6575#issue-114027248 mentions “CCITTFaxStream” let’s mark this as duplicate of #6741.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to display whole PDF (not only one page) with PDF.JS?
The pdfjs-dist library contains parts for building PDF viewer. You can use PDFPageView to render all pages. Based ...
Read more >
Getting Started
A general-purpose, web standards-based platform for parsing and rendering PDFs. ... git clone https://github.com/mozilla/pdf.js.git $ cd pdf.js ...
Read more >
I made some big improvements to pdf.js's speed and memory ...
If you have particular PDFs that cause pdf.js to run slowly, please file bugs about them at bugzilla.mozilla.org under the "Firefox" product and...
Read more >
Changelog of ngx-extended-pdf-viewer - PdfShowcase
The 2.1 file is going to be changed after checking for detrimental side-effects. ... Also see https://github.com/mozilla/pdf.js/issues/10948 and ...
Read more >
What is PDF.js
But nobody had implemented a PDF viewer in HTML5 and JavaScript. Building one from scratch and native code-free would let Mozilla do something ......
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