Change code base to improve performance of PDFJS (see the issue https://github.com/mozilla/pdf.js/issues/6493)
See original GitHub issueAll,
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:
- File for testing: https://drive.google.com/open?id=0BzoKdQwBinAnXzVJcmdVZjBmbkE
- System detail: my computer’s hardware: Window 7x 64, RAM: 12 GB, Processors: Intel Core i5. I use Chrome browser and its version is 46.0.2490.80 m
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:
- Created 8 years ago
- Comments:16 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
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.