Closed boyuyang2 closed 2 years ago
That's two bugs:
As for installing a fresh Angular application: that's a matter of five minutes:
ng new demo
cd demo
ng add ngx-extended-pdf-viewer
application.component.html
.tried to attach the browser console screenshot, but failed to attach with both PNG and JPEG format, Here is a copy of the text from there,
ngx-extended-pdf-viewer.mjs:3754 The height of the PDF viewer widget is zero pixels. Please check the height attribute. Is there a syntax error? Or are you using a percentage with a CSS framework that doesn't support this? The height is adjusted automatedly.
checkHeight @ ngx-extended-pdf-viewer.mjs:3754
(anonymous) @ ngx-extended-pdf-viewer.mjs:3310
timer @ zone.js:3128
_ZoneDelegate.invokeTask @ zone.js:443
onInvokeTask @ core.mjs:25595
_ZoneDelegate.invokeTask @ zone.js:442
Zone.runTask @ zone.js:214
ZoneTask.invokeTask @ zone.js:525
ZoneTask.invoke @ zone.js:514
data.args.
Here is my code,
<ngx-extended-pdf-viewer
[src]=localDocumentUrl
[height]="'90%'"
[showDownloadButton]="true"
[zoom]="'auto'"
[useBrowserLocale]="true">
</ngx-extended-pdf-viewer>
Thanks! All right, I can see there's some problem here, but I don't have a clue how it's related to the bug you've reported. But maybe it vanishes after getting rid of the console message.
The message means exactly what it says: when I started implementing ngx-extended-pdf-viewer, I often ran into strange bugs. The PDF viewer wouldn't show. After a long period of frustration and desperation, I learned that CSS is tricky. Sometimes, it tricks the PDF viewer into being modest. It'd take 0 pixels height. In other words, it's invisible.
There's that. I solved the problem by forcing the PDF viewer to use at least 100 pixels of height. Plus, I had it emit an error message. I can only guess, because I haven't seen your source code nor your running application, but I suppose that's what happening on your machine. Your setting of 90% is ignored for some reason unknown, the error message is printed, and the PDF viewer shows with merely 100 pixels height.
But that's not the issue you're reporting.
Your printing bug is almost certainly related to your CSS rules. Oh, wait: in rare cases, it's caused by your PDF document. I still have to understand when and why the bug occurs, but sometimes this CSS rule helps:
body[data-pdfjsprinting] #printContainer>.printedPage {
width: 99.99% !important; // or 99%
}
Your download problem still puzzles me. The algorithm downloading a PDF file is as simple as can be. No idea how it can go wrong. But obviously it does.
Would you mind to send me a reproducer? That's a very simple but complete project showing the problem. Ideally, it's a GitHub project, but I don't insist on that. What I do insist on is that it does not rely on any third-party dependency. I don't want to install a database, or something like that. Bear with me: this project is a leisure-time project, and my leisure time is every bit as limited as your's. Unless you're ready to talk to my employer. That's always an option, but I don't assume you want to go this road.
Oh, just in case this sounds disappointing: don't be. We're going to solve this issue!
Best regards, Stephan
Sounds like there is an issue to the 'height' attribute, I tried with both pixels and vh, they are not working properly, always showed a very narrow window, only the percentage works.
I tried to add the pdf document to a modal dialog window.
Did you add a timeout? Modal dialogs are often a bit tricky. The strategy that usually works is opening the modal without showing the PDF viewer (`*ngIf="false") and showing the PDF viewer after a short timeout.
Any progress? I didn't here from you for a long time, so I'm going to close this issue now.
i have the same problem in ios, pdf not download
I recently tried to use ngx-extended-pdf-viewer, most seems good, when I clicked on the download button from the upper right corner, nothing happened, I also tried with the print button, it works, but inserted a blank page between each pages, what I might have missed? I tried in both Chrome and Firefox, it worked the same. version 13.5.2
Please help.
Thanks.
Boyu Yang