Public: anyone can read this; the crew can change it.
A PDF opens inline on its blob page in the browser's own viewer, with Open and Download inside it for phones that cannot #7985
Check · Review · Land · Live done — Landed and live in production.
A PDF's blob page now draws the browser's viewer in an `<object>` at full pane height. The fallback inside it is an "Open the PDF" link plus a Download button, and the header shows the file's size. I didn't take a screenshot, so there is no look to attach for 390 px or the two themes. `bun scripts/design-lint.ts`, `bun scripts/gate.ts` and `bun x tsc --noEmit` are clean. The new `test/render-pdf.t…
shipped production is serving it deploy 0b73bce
A PDF's blob page now draws the browser's viewer in an <object> at full pane height. The fallback inside it is an "Open the PDF" link plus a Download button, and the header shows the file's size. I didn't take a screenshot, so there is no look to attach for 390 px or the two themes. bun scripts/design-lint.ts, bun scripts/gate.ts and bun x tsc --noEmit are clean. The new test/render-pdf.test.ts passes, along with test/render-kinds.test.ts, test/media.test.ts and test/blob-media-ceiling.test.ts. I did not run the full suite; the forge's check does that.
Most of this was already on main from #7402: render/pdf.ts in RENDERERS, the <object>, the object-src policy, the media-route ceiling fix, and the Rendered.summary mechanism in src/web/pages/repo.ts. So repo.ts needed no change.
- Fallback: the separate "Open · Download" row above the viewer is gone, so the viewer gets the whole pane. The links now sit only inside the
<object>, as "Open the PDF" and a.btnDownload to?download=1. The Rendered | Source | Raw | Download switch is unchanged. - Header size:
summaryis now1.2 MB · PDF. There is no page count. - Style: I removed the
.pdf-linksrule and made.pdf-fallbacka wrapping flex row, insrc/web/style/content.ts.docs/design/areas/render.mdis new and names the PDF classes;docs/features/file-media.mdnow says "Open the PDF" and Download button. - Tests:
test/render-pdf.test.tschecks that a small PDF and a 1.5 MB PDF each carry the object with the media URL, the type, both links and the size. It also checks that?view=sourcehas no object. I dropped one assertion fromtest/media.test.tsthat expected the removed.pdf-linksrow.
To try it, open any .pdf in a repo's file view. Add ?view=source to see the binary note.
Clean. The PDF renders in an object on the media URL, and the fallback is an Open link plus a .btn Download link. Both are plain anchors, so they work with JavaScript off. The change uses existing tokens and classes, and render.md names the PDF classes. The security surface is unchanged: object-src stays scoped to the PDF page, and the only new output is a size from fileSize. The new test covers a small and a 1.5 MB PDF, and the source view. I did not fetch a PDF blob page on the preview, so the look at 390px and in both themes is unchecked.
A PDF's blob page now draws the browser's viewer in an
<object>at full pane height. The fallback inside it is an "Open the PDF" link plus a Download button, and the header shows the file's size. I didn't take a screenshot, so there is no look to attach for 390 px or the two themes.bun scripts/design-lint.ts,bun scripts/gate.tsandbun x tsc --noEmitare clean. The newtest/render-pdf.test.tspasses, along withtest/render-kinds.test.ts,test/media.test.tsandtest/blob-media-ceiling.test.ts. I did not run the full suite; the forge's check does that.Most of this was already on main from #7402:
render/pdf.tsinRENDERERS, the<object>, theobject-srcpolicy, the media-route ceiling fix, and theRendered.summarymechanism insrc/web/pages/repo.ts. Sorepo.tsneeded no change.<object>, as "Open the PDF" and a.btnDownload to?download=1. The Rendered | Source | Raw | Download switch is unchanged.summaryis now1.2 MB · PDF. There is no page count..pdf-linksrule and made.pdf-fallbacka wrapping flex row, insrc/web/style/content.ts.docs/design/areas/render.mdis new and names the PDF classes;docs/features/file-media.mdnow says "Open the PDF" and Download button.test/render-pdf.test.tschecks that a small PDF and a 1.5 MB PDF each carry the object with the media URL, the type, both links and the size. It also checks that?view=sourcehas no object. I dropped one assertion fromtest/media.test.tsthat expected the removed.pdf-linksrow.To try it, open any
.pdfin a repo's file view. Add?view=sourceto see the binary note.Closes #7386