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.

Page render promise throws errors and hangs reading process

See original GitHub issue

Hi,

the issue im working on is to render pdf’s with the size of 200MB and more, with not many pages, but full of content (less then 70 pages per doc).

One of pdf documents contain a page that is somehow corrupted. I don’t mind, cause all the rest displays well, but my reading process hangs when it comes to read this corrupted page.

What i’m doing is rendering pages to canvas using js promise like this:

var renderPromise = page.render(renderContext).promise;
renderPromise.then(function () {
    // render next page normally
})
.catch(function () {
    // handle exception situations
});

but it never enters catch block not then block… The process is stuck. Anyone can help me with this issue? Am i doing it wrong or pdf.js contain some bug and will never enter catch block?

Console log:

["Warning: Ignoring invalid character "144" in hex string" pdf.worker.js:235:4
"Warning: Unknown command "ÎtÈDž"" pdf.worker.js:235:4
"Warning: Unknown command "?:¢GOž"" pdf.worker.js:235:4
"Error: Illegal character: 41" pdf.worker.js:250:4
"Lexer_getObj@https://localhost:44300/Scripts/core/pdf.worker.js:30715:11
Parser_shift@https://localhost:44300/Scripts/core/pdf.worker.js:29977:21
Parser_getObj@https://localhost:44300/Scripts/core/pdf.worker.js:29982:7
EvaluatorPreprocessor_read@https://localhost:44300/Scripts/core/pdf.worker.js:12642:19
next@https://localhost:44300/Scripts/core/pdf.worker.js:11134:17
next/<@https://localhost:44300/Scripts/core/pdf.worker.js:11356:13
" pdf.worker.js:252:0
"Warning: Unsupported feature "unknown"" pdf.worker.js:235:4
"Warning: Unsupported feature "unknown"" pdf.js:235:3
"Error: Bad encoding in flate stream" pdf.worker.js:250:4
"FlateStream_getCode@https://localhost:44300/Scripts/core/pdf.worker.js:31449:7
FlateStream_readBlock@https://localhost:44300/Scripts/core/pdf.worker.js:31631:15
DecodeStream_getByte@https://localhost:44300/Scripts/core/pdf.worker.js:31170:9
predictorStreamReadBlockPng@https://localhost:44300/Scripts/core/pdf.worker.js:31759:21
DecodeStream_getBytes@https://localhost:44300/Scripts/core/pdf.worker.js:31194:11
PDFImage_getImageBytes@https://localhost:44300/Scripts/core/pdf.worker.js:26996:14
PDFImage_createImageData@https://localhost:44300/Scripts/core/pdf.worker.js:26874:22
PartialEvaluator_buildPaintImageXObject/<@https://localhost:44300/Scripts/core/pdf.worker.js:10741:25
" pdf.worker.js:252:0
"Warning: Unsupported feature "unknown"" pdf.worker.js:235:4
"Warning: Unsupported feature "unknown"" pdf.js:235:3
"Warning: Unable to decode image: Error: Bad encoding in flate stream"

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yurydelendikcommented, Mar 13, 2015

Unfortunately i cannot post this PDF public, because it may contain sensitive data, but i can show you more of my code that is responsible for displaying PDF pages

Not providing complete code and broken PDF adds additional and unnecessary complexity for a contributor to diagnose the problem (unless they have unlimited time to help with your project). In most cases such issues will stay unresolved and eventually closed as incomplete. Please add a link to you solution and/or provide sample PDF.

See also https://github.com/mozilla/pdf.js/blob/master/CONTRIBUTING.md

0reactions
yurydelendikcommented, Nov 10, 2015

Closing as incomplete. Sorry, but link to the solution was not provided – code snippets and PDF are not helping to troubleshoot the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Uncaught ReferenceError: process is not defined
Today I added a very simple Modal component and somehow iframe started appearing. It appears when I am editing the file and hot...
Read more >
Let It Crash: Best Practices for Handling Node.js Errors on ...
An unhandledRejection error is a newer concept. It is emitted when a promise is not satisfied; in other words, a promise was rejected...
Read more >
Handling common JavaScript problems - MDN Web Docs
Now we'll look at common cross-browser JavaScript problems and how to fix them. This includes information on using browser dev tools to ...
Read more >
Handle errors in ASP.NET Core Blazor apps - Microsoft Learn
NET Core apps that run on the server with a middleware processing pipeline, ... Renders error UI when an unhandled exception is thrown....
Read more >
Top 10 Most Common Node.js Developer Mistakes - Toptal
js developers. Mistake #6: Throwing Errors from Inside Callbacks. JavaScript has the notion of exceptions. Mimicking the syntax of almost all traditional ...
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