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.

"Invalid or corrupted PDF files" is displayed

See original GitHub issue

Attach (recommended) or Link to PDF file here: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.144.7135&rep=rep1&type=pdf

Configuration:

  • Web browser and its version: Chrome 72.0.3621.121 (Official Build) (64-bit)
  • Operating system and its version: MacOS
  • PDF.js version: PDF.js v2.0.673 (build: 31012570)
  • Is a browser extension: Yes

Steps to reproduce the problem:

  1. Click the above link

What is the expected behavior? (add screenshot) This is what I can see when I pasted chrome-extension prefixed url or reloading the error pdf page. (chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.144.7135&rep=rep1&type=pdf) Screen Shot 2019-03-12 at 17 20 26

What went wrong? (add screenshot) This is what I can see when click the above link Screen Shot 2019-03-12 at 17 19 38

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension): https://chrome.google.com/webstore/detail/pdf-viewer/oemmndcbldboiebfnladdacbdfmadadm

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
simonhongcommented, Mar 15, 2019

I found the cause of this issue. The reason is requesting twice to server in a very short interval. To the second request, server redirects to downloadsexceeded.html instead of pdf content. So, pdf.js complains it’s invalid/corrupted pdf file. It’s maybe server’s DDoS protection I think.

Why two requests are issued when user clicks that link? First one is issued by browser for user click. Then, pdfjs extension intercepts header response and redirects to extension url. Then, one more requesting is issued by pdf.js.

I think we can improve this more. How about using the contents received from first request instead of requesting again? This is just an idea. (Sorry, if this idea doesn’t make sense. I don’t fully understand about pdf.js/extension implementation now.).

WDYT? @timvandermeij @Rob--W

0reactions
timvandermeijcommented, Aug 24, 2019

Closing since this seems to work again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PDF Links will not open, result in "invalid or corrupted" warning
Several sites with PDF links result in “Invalid or corrupted PDF file” message instead of displaying or downloading the file.
Read more >
Error: Invalid or corrupted PDF file Firefox - Stack Overflow
It looks like you've overengineered the solution a little bit document.getElementById('uploadedFileIframe').src = reader.result;.
Read more >
Ways to fix “Format Error: not a PDF or corrupted”
Your answer to restore entire corrupt PDF file is PDF file repair software; the final way to fix this error is by repairing...
Read more >
Repair Corrupted or Damaged PDF File with 4 Ways
Part 1: Possible Reasons for PDF File Corrupted or Damaged? · Improper download: While downloading the PDF files, sometimes you have an unstable...
Read more >
'Invalid or corrupted PDF file' error when loading a Word ...
If the converted pdf file is not present in sys_attachment table, then it will convert again, so showing correct the next time the...
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