From 71e1a26b08f667db96993951b0b92519c8a76d2b Mon Sep 17 00:00:00 2001 From: Daniele Date: Sat, 8 Aug 2026 17:16:15 +0100 Subject: [PATCH] fix(ui): render PDFs with pdf.js instead of an iframe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On iOS the file viewer showed only the first page of a PDF, with no way to scroll to the rest — the document had to be downloaded and opened in another app. The cause was not ours: WebKit refuses to mount its PDF viewer inside an `); + // Drawn by (pdf.js on canvas), never by the browser's built-in + // viewer in an `); + // Successfully compiled server-side — render the resulting PDF exactly as + // a native .pdf is rendered (see the note above). + return html``; } if (this._kind === 'svg' && this._blobUrl) { // `allow-same-origin` (and nothing else) is required so the iframe can load diff --git a/web/components/shared/pdf-view.js b/web/components/shared/pdf-view.js new file mode 100644 index 0000000..9933b16 --- /dev/null +++ b/web/components/shared/pdf-view.js @@ -0,0 +1,410 @@ +import { html, nothing } from 'lit'; +import { LightElement } from '../../lib/base.js'; +import { t } from '../../lib/i18n.js'; + +/** + * `` — a continuous, scrollable PDF renderer built on the + * vendored pdf.js. + * + * It exists because the obvious implementation — `