I’ve been using the standard PDF embedding syntax without problems [foo](/docs/bar.pdf), but this no longer works properly with the lastest Chrome update. When a user clicks on the link it is rendered in a tiny window, and there is an option to pull it into Chrome reader mode. Chrome no longer renders in the entire Browswer window. The problem does not occur with Firefox, so it is a Chrome problem. Any tips would be appreciated. Otherwise, this is a heads up!
After some poking around it seems there is a Hugo SPA layer betwen the PDF and the browser, and it results in the PDF being displayed in a tiny viewport. Using Ctrl + increases the size of the text, but not the size of the viewport (a peephole). I can open PDF files from other websites without problems, and I can navigate to a PDF file using file:// and display without problems. This is probably a Chrome/Ubuntu bug, but I wonder if this SPA theory is correct?
Static Site Generators make static sites, the very opposite of SPAs. file:/home/drm/Booking_We_couldnt_get_you_any_refund.pdfworks because /home/drm/Booking_We_couldnt_get_you_any_refund.pdfis an absolute path on your disk.
Your URL should be a path relative either to the current page, or either public or htdocs, whichever folder is your project’s root…
Thanks, this is an issue with Chrome under Ubuntu Linux. Works fine with Firefox on Ubuntu and on Windows, and it used to work with Chrome under Ubuntu before recent updates.
No, it’s not. Try it using Hugo version v0.159.0 or later:
git clone --single-branch -b hugo-forum-topic-56370 https://github.com/jmooring/hugo-testing hugo-forum-topic-56370
cd hugo-forum-topic-56370
hugo server
The work-around was to go to chrome://settings/content/all then search for localhost:1313then click on trash can to remove saved settings for this site. This tip came from ChatGPT.
Update: Addition details on this problem. It turns out there is a relatively new flag OOPIF for PDF Viewer listed under chrome://flags, and it is enabled by default (a new feature under active development). The correct solution for the bad PDF rendering problem is to disable this option, so the older rendering policy is used. The older policy will be disabled when the new one is fully tested.