I have checked the live demo example: https://atapuerca.de/simple.
It always downloads the pdf file and pdf viewer shows an error "Invalid or corrupted PDF file".
My version of chrome is: 74.0.3729.169
This is what I am getting in console:
main-es2015.489b1c508ad34eb7a861.js:1 ERROR TypeError: Cannot read property 'on' of null
at main-es2015.489b1c508ad34eb7a861.js:1
at a.invokeTask (polyfills-es2015.e954256595c973372414.js:1)
at Object.onInvokeTask (main-es2015.489b1c508ad34eb7a861.js:1)
at a.invokeTask (polyfills-es2015.e954256595c973372414.js:1)
at s.runTask (polyfills-es2015.e954256595c973372414.js:1)
at invokeTask (polyfills-es2015.e954256595c973372414.js:1)
at invoke (polyfills-es2015.e954256595c973372414.js:1)
at n.args.
ie @ main-es2015.489b1c508ad34eb7a861.js:1
handleError @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
i @ main-es2015.489b1c508ad34eb7a861.js:1
__tryOrUnsub @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
_next @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
emit @ main-es2015.489b1c508ad34eb7a861.js:1
(anonymous) @ main-es2015.489b1c508ad34eb7a861.js:1
invoke @ polyfills-es2015.e954256595c973372414.js:1
run @ polyfills-es2015.e954256595c973372414.js:1
runOutsideAngular @ main-es2015.489b1c508ad34eb7a861.js:1
onHandleError @ main-es2015.489b1c508ad34eb7a861.js:1
handleError @ polyfills-es2015.e954256595c973372414.js:1
runTask @ polyfills-es2015.e954256595c973372414.js:1
invokeTask @ polyfills-es2015.e954256595c973372414.js:1
invoke @ polyfills-es2015.e954256595c973372414.js:1
n.args.
setTimeout (async)
a @ polyfills-es2015.e954256595c973372414.js:1
scheduleTask @ polyfills-es2015.e954256595c973372414.js:1
onScheduleTask @ polyfills-es2015.e954256595c973372414.js:1
scheduleTask @ polyfills-es2015.e954256595c973372414.js:1
scheduleTask @ polyfills-es2015.e954256595c973372414.js:1
scheduleMacroTask @ polyfills-es2015.e954256595c973372414.js:1
g @ polyfills-es2015.e954256595c973372414.js:1
(anonymous) @ polyfills-es2015.e954256595c973372414.js:1
M.s.
ngAfterViewInit @ main-es2015.489b1c508ad34eb7a861.js:1
_r @ main-es2015.489b1c508ad34eb7a861.js:1
vr @ main-es2015.489b1c508ad34eb7a861.js:1
wr @ main-es2015.489b1c508ad34eb7a861.js:1
po @ main-es2015.489b1c508ad34eb7a861.js:1
_o @ main-es2015.489b1c508ad34eb7a861.js:1
wo @ main-es2015.489b1c508ad34eb7a861.js:1
po @ main-es2015.489b1c508ad34eb7a861.js:1
_o @ main-es2015.489b1c508ad34eb7a861.js:1
vo @ main-es2015.489b1c508ad34eb7a861.js:1
po @ main-es2015.489b1c508ad34eb7a861.js:1
_o @ main-es2015.489b1c508ad34eb7a861.js:1
wo @ main-es2015.489b1c508ad34eb7a861.js:1
po @ main-es2015.489b1c508ad34eb7a861.js:1
_o @ main-es2015.489b1c508ad34eb7a861.js:1
wo @ main-es2015.489b1c508ad34eb7a861.js:1
po @ main-es2015.489b1c508ad34eb7a861.js:1
detectChanges @ main-es2015.489b1c508ad34eb7a861.js:1
tick @ main-es2015.489b1c508ad34eb7a861.js:1
(anonymous) @ main-es2015.489b1c508ad34eb7a861.js:1
invoke @ polyfills-es2015.e954256595c973372414.js:1
onInvoke @ main-es2015.489b1c508ad34eb7a861.js:1
invoke @ polyfills-es2015.e954256595c973372414.js:1
run @ polyfills-es2015.e954256595c973372414.js:1
run @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
i @ main-es2015.489b1c508ad34eb7a861.js:1
__tryOrUnsub @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
_next @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
next @ main-es2015.489b1c508ad34eb7a861.js:1
emit @ main-es2015.489b1c508ad34eb7a861.js:1
ts @ main-es2015.489b1c508ad34eb7a861.js:1
onHasTask @ main-es2015.489b1c508ad34eb7a861.js:1
hasTask @ polyfills-es2015.e954256595c973372414.js:1
_updateTaskCount @ polyfills-es2015.e954256595c973372414.js:1
_updateTaskCount @ polyfills-es2015.e954256595c973372414.js:1
runTask @ polyfills-es2015.e954256595c973372414.js:1
_ @ polyfills-es2015.e954256595c973372414.js:1
Promise.then (async)
g @ polyfills-es2015.e954256595c973372414.js:1
scheduleTask @ polyfills-es2015.e954256595c973372414.js:1
onScheduleTask @ polyfills-es2015.e954256595c973372414.js:1
scheduleTask @ polyfills-es2015.e954256595c973372414.js:1
scheduleTask @ polyfills-es2015.e954256595c973372414.js:1
scheduleMicroTask @ polyfills-es2015.e954256595c973372414.js:1
C @ polyfills-es2015.e954256595c973372414.js:1
then @ polyfills-es2015.e954256595c973372414.js:1
appInitializer @ main-es2015.489b1c508ad34eb7a861.js:1
runInitializers @ main-es2015.489b1c508ad34eb7a861.js:1
(anonymous) @ main-es2015.489b1c508ad34eb7a861.js:1
(anonymous) @ main-es2015.489b1c508ad34eb7a861.js:1
(anonymous) @ main-es2015.489b1c508ad34eb7a861.js:1
invoke @ polyfills-es2015.e954256595c973372414.js:1
onInvoke @ main-es2015.489b1c508ad34eb7a861.js:1
invoke @ polyfills-es2015.e954256595c973372414.js:1
run @ polyfills-es2015.e954256595c973372414.js:1
run @ main-es2015.489b1c508ad34eb7a861.js:1
bootstrapModuleFactory @ main-es2015.489b1c508ad34eb7a861.js:1
zUnb @ main-es2015.489b1c508ad34eb7a861.js:1
f @ runtime-es2015.858f8dd898b75fe86926.js:1
0 @ main-es2015.489b1c508ad34eb7a861.js:1
f @ runtime-es2015.858f8dd898b75fe86926.js:1
t @ runtime-es2015.858f8dd898b75fe86926.js:1
r @ runtime-es2015.858f8dd898b75fe86926.js:1
(anonymous) @ main-es2015.489b1c508ad34eb7a861.js:1
Show 39 more frames
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Setting up fake worker.
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "104" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "116" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "109" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "108" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "104" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "116" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "105" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "116" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "108" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "104" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "116" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "109" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "108" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Ignoring invalid character "104" in hex string
scripts.3e2ed0298b9a0904dd68.js:1 Warning: Indexing all PDF objects
main-es2015.489b1c508ad34eb7a861.js:1 ERROR Error: Uncaught (in promise): Error: Invalid or corrupted PDF file.
Error: Invalid or corrupted PDF file.
at scripts.3e2ed0298b9a0904dd68.js:1
at a.invoke (polyfills-es2015.e954256595c973372414.js:1)
at Object.onInvoke (main-es2015.489b1c508ad34eb7a861.js:1)
at a.invoke (polyfills-es2015.e954256595c973372414.js:1)
at s.run (polyfills-es2015.e954256595c973372414.js:1)
at polyfills-es2015.e954256595c973372414.js:1
at a.invokeTask (polyfills-es2015.e954256595c973372414.js:1)
at Object.onInvokeTask (main-es2015.489b1c508ad34eb7a861.js:1)
at a.invokeTask (polyfills-es2015.e954256595c973372414.js:1)
at s.runTask (polyfills-es2015.e954256595c973372414.js:1)
at P (polyfills-es2015.e954256595c973372414.js:1)
at polyfills-es2015.e954256595c973372414.js:1
at polyfills-es2015.e954256595c973372414.js:1
at a.invoke (polyfills-es2015.e954256595c973372414.js:1)
at Object.onInvoke (main-es2015.489b1c508ad34eb7a861.js:1)
at a.invoke (polyfills-es2015.e954256595c973372414.js:1)
at s.run (polyfills-es2015.e954256595c973372414.js:1)
at polyfills-es2015.e954256595c973372414.js:1
at a.invokeTask (polyfills-es2015.e954256595c973372414.js:1)
at Object.onInvokeTask (main-es2015.489b1c508ad34eb7a861.js:1)
I've got the same version of Google Chrome. I've tried my demo on Windows and on my MacBook. Most of the time it works flawlessly. Sometimes I see the message "corrupted PDF file" in the toolbar of the PDF viewer.
Until now, I always shrugged it off and just reloaded the page. It seems to work flawlessly, except for rare exceptions when trying it for the first time.
So I've got two questions:
Just another question: how fast is your network? I've noticed my demo reliably fails on 3G connections. The limit seems to be between 100 and 200 Kbit/s.
Ahhh Man. I have tried to implement the PDF viewer for my site and have failed after trying many of them including all of the famous PDF viewers like PDF.JS etc. The viewer always downloads the file despite showing it.
Now, I have solved the problem by just turning off the "Internet Download Manager" chrome extension. It is working flawlessly.
Is any trick to avoid this situation in your mind...???
By the way, "https://www.speedtest.net/" showing my internet speed as 5.63 MBPS. And your demo working great...
That's really an unexpected explanation. I have to admit I read the keyword "download", but I dismissed it and looked for other ways to reproduce the error. It's interesting I did find something :)
Thanks a lot for your precious time here. And yes, your extension is awesome.
Keep it up...
I don't think that's anything I can solve on the JavaScript side. However, you can customize the Internet Download Manager. How a look at these two options, maybe one of them helps:
http://www.internetdownloadmanager.com/register/new_faq/video14.html (this link is about videos, but the second tab of the screenshot looks promising)