Stirling-Tools / Stirling-PDF

#1 Locally hosted web application that allows you to perform various operations on PDF files
https://stirlingpdf.com
MIT License
44.97k stars 3.67k forks source link

Issues with view-pdf #468

Closed ekadin-mtc closed 9 months ago

ekadin-mtc commented 12 months ago

I am having 2 issues with the view-pdf feature.

  1. The navigation icons in the top right corner are not rendering correctly.

screenshot1

  1. When I add an image, it shrinks down to a line and can't be resized.

screenshot2

Frooodle commented 12 months ago

Few things

Can you press f12 and right click refresh button and do refresh hard and cache

If that doesn't work can you also answer

Are you running with login function

Are you using nginx or similar?

Frooodle commented 12 months ago

And any logs in the f12 console

ekadin-mtc commented 12 months ago

@Frooodle A hard refresh did not help. I was running with the login function, but I turned it off and still had the same issue. I didn't notice any issues in the F12 console.

I am running behind a Cloudflare tunnel.

mk-hs commented 11 months ago

It looks like view-pdf doesn't work properly if the SYSTEM_ROOTURIPATH environment variable is set. It's trying to load a couple files like pdf.js, but tries to access from the root path. If system_rooturipath is set to /pdf, it should access the file from /pdf/pdfjs/pdf.js but instead tries to access /pdfjs/pdf.js which is resulting in a 404 error.

Something like RewriteRule ^/pdfjs/(.*?)$ /pdf/pdfjs/$1 [R] should work as a quick fix in your reverse proxy config.

It's possible that my issue is unrelated, but perhaps it isn't. The whole page was refusing to load properly for me.

Frooodle commented 11 months ago

Thanks for the investigation on this I'll see what I can do on my end!

ekadin-mtc commented 11 months ago

Thank you @mk-hs for your input. Unfortunately, that doesn't seem to be the issue in my case as I don't have the SYSTEM_ROOTURIPATH set (as far as I know). I don't know what the location of pdf.js is in my system (Kubernetes), but I do know that /pdfjs/pdf.worker.js is loading just fine.

Frooodle commented 11 months ago

I am making some changes to fix that rootpath issue Hoping we get lucky and it fixes your issue too

HagspielBu commented 11 months ago

Hello, have you found an idea for the solution yet? Here the longlist of Problems, produced under Firefox by starting the app:

Layout-Darstellung wurde erzwungen, bevor die Seite vollständig geladen war. Falls Stylesheet noch nicht geladen sind, kann dies zu einem kurzzeitigen Darstellung des Inhalts ohne Formatierung führen. view-pdf

back_to_home is undefined. viewer.js:14124:33

back_to_home is undefined. viewer.js:14178:33

back_to_home_label is undefined. viewer.js:14124:33

back_to_home_label is undefined. viewer.js:14178:33

back_to_home is undefined. viewer.js:14124:33

back_to_home is undefined. viewer.js:14178:33

back_to_home_label is undefined. viewer.js:14124:33

back_to_home_label is undefined. viewer.js:14178:33

editor_alt_text_dialog_label is undefined. viewer.js:14124:33

editor_alt_text_dialog_label is undefined. viewer.js:14178:33

editor_alt_text_dialog_description is undefined. viewer.js:14124:33

editor_alt_text_dialog_description is undefined. viewer.js:14178:33

editor_alt_text_add_description_label is undefined. viewer.js:14124:33

editor_alt_text_add_description_label is undefined. viewer.js:14178:33

editor_alt_text_add_description_description is undefined. viewer.js:14124:33

editor_alt_text_add_description_description is undefined. viewer.js:14178:33

editor_alt_text_textarea is undefined. viewer.js:14124:33

editor_alt_text_textarea is undefined. viewer.js:14178:33

editor_alt_text_mark_decorative_label is undefined. viewer.js:14124:33

editor_alt_text_mark_decorative_label is undefined. viewer.js:14178:33

editor_alt_text_mark_decorative_description is undefined. viewer.js:14124:33

editor_alt_text_mark_decorative_description is undefined. viewer.js:14178:33

editor_alt_text_cancel_button is undefined. viewer.js:14124:33

editor_alt_text_cancel_button is undefined. viewer.js:14178:33

editor_alt_text_save_button is undefined. viewer.js:14124:33

editor_alt_text_save_button is undefined. viewer.js:14178:33

Die drawWindow-Methode von CanvasRenderingContext2D ist veraltet. Verwenden Sie stattdessen die Erweiterungs-API tabs.captureTab https://developer.mozilla.org/docs/Mozilla/Add-ons/WebExtensions/API/tabs/captureTab pagedata-script.js:1:12509 PDF 289a576d8b729810b84600c76ce988b7 [1.7 LibreOffice 7.6 / Writer] (PDF.js: 3.11.174 [ce8716743]) app.js:1674:56 Warning: TT: undefined function: 21 pdf.worker.js:1019:13

editor_alt_text_button_label is undefined. viewer.js:14124:33

editor_alt_text_edit_button_label is undefined. viewer.js:14124:33

editor_alt_text_decorative_tooltip is undefined. viewer.js:14124:33

Frooodle commented 10 months ago

Can you report back if you still have issues!

ekadin-mtc commented 10 months ago

Can you report back if you still have issues!

I updated to 0.16.1 without changing anything else. Still having the same issues.

Frooodle commented 10 months ago

Weird another person raised same issue and said it was resolved

HagspielBu commented 10 months ago

Same problem not solved for me yet. You can test it for yourself here: https://pdf.hub.s-w-w.com/view-pdf

Frooodle commented 10 months ago

image

Frooodle commented 10 months ago

Now im even more confused

Frooodle commented 10 months ago

What browser are you using, perhaps browser specific?

ekadin-mtc commented 10 months ago

I'm having the issues across different browsers and computers. I tested in Edge, Chrome and Firefox. @Frooodle is your screenshot from @HagspielBu 's link?

Frooodle commented 10 months ago

Yes it's from that link How weird

HagspielBu commented 10 months ago

You can also test it under iOS or Android. No difference in this behaviour. I analysed the logs of the docker-stack: No faults. I suppose, it is the JS-intpretor. Realy funny! If I find some time next days, I make an installation under Synology-Linux. Or is there anywhere a better docker-build?

It's not realy a great problem. You can import pictures with ".../add-image". But for the moment, there are some more difficults with performance (OCRmyPDF and Tesseract for OCR works really slow.) And the proggy still produce uncaught failiures.

One more problem is the bad workflow: The different functions are not integrated. To load the same file for every different operation is a little bit crazy. Perhaps an integration under Nextcloud would be a good idea? Good evening!

HagspielBu commented 10 months ago

The tested with the three standards Chrome, Firefox and Edge under Windows 11 and Android.

PS1: On your screenshot I miss the buttons for import pictures and so on.

PS2: Is there perhaps a problem with the language (german)?

Tschau!

Burkard

Von: Anthony Stirling @.> Gesendet: Dienstag, 12. Dezember 2023 23:51 An: Frooodle/Stirling-PDF @.> Cc: HagspielBu @.>; Comment @.> Betreff: Re: [Frooodle/Stirling-PDF] Issues with view-pdf (Issue #468)

What browser are you using, perhaps browser specific?

— Reply to this email directly, view it on GitHub https://github.com/Frooodle/Stirling-PDF/issues/468#issuecomment-1852936732 , or unsubscribe https://github.com/notifications/unsubscribe-auth/ALIXZBKLTGVSHDS5XOTKNFDYJDNUFAVCNFSM6AAAAAA7AISRBWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNJSHEZTMNZTGI . You are receiving this because you commented. https://github.com/notifications/beacon/ALIXZBNUIAR5GHB6PYPJFGTYJDNUFA5CNFSM6AAAAAA7AISRBWWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTOOGJBY.gif Message ID: @. @.> >

chain710 commented 10 months ago

It looks like view-pdf doesn't work properly if the SYSTEM_ROOTURIPATH environment variable is set. It's trying to load a couple files like pdf.js, but tries to access from the root path. If system_rooturipath is set to /pdf, it should access the file from /pdf/pdfjs/pdf.js but instead tries to access /pdfjs/pdf.js which is resulting in a 404 error.

Something like RewriteRule ^/pdfjs/(.*?)$ /pdf/pdfjs/$1 [R] should work as a quick fix in your reverse proxy config.

It's possible that my issue is unrelated, but perhaps it isn't. The whole page was refusing to load properly for me.

I'm having exactly this issue

mk-hs commented 10 months ago

I can confirm that this issue still persists, the rewrite rule is still necessary, otherwise:

GET https://server.url/pdfjs/pdf.worker.js Status 404 Not Found although https://server.url/rooturl/pdfjs/pdf.worker.js would be required.

The original issue seems to be unrelated though.

andrewdolphin commented 10 months ago

I too have the image shrinking issue - installed using the docker image using chrome, edge and safari on ios all showing the same behaviour

andrewdolphin commented 9 months ago

I'm struggling to debug the image resize bug. It appears to be a bug in Stirling-PDF itself - I've tried on a couple of public instances and they show the same behaviour.

Adding an image to the mozilla pdf.js example (https://mozilla.github.io/pdf.js/web/viewer.html) does not exhibit the same bug on the same browsers.

andrewdolphin commented 9 months ago

More testing. It appears to be an error caused by the inclusion of bootstrap.min.css

Removing that link reverts the page to its expected behaviour.

Discovering that shows that if the page overwrites the css as follows if fixes the problem:

* { -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; }

https://github.com/VadimDez/ng2-pdf-viewer/issues/795