feat(pptx): raster-slide mode — pixel-exact full-slide pictures#408
Merged
Conversation
DemchaAV
force-pushed
the
feature/pptx-raster-slides
branch
from
July 17, 2026 09:57
e4ad54a to
705df99
Compare
PptxFixedLayoutBackend.Builder.rasterSlides(int dpi) renders every page through the PDF backend at the given DPI and places it as one full-slide picture, so the deck is a pixel-exact copy of the PDF/PNG output — for decks that must look identical on any machine regardless of fonts. The trade-off is a picture per slide: text is not selectable or editable and files grow with resolution, so the editable vector mode stays the default and the provider path is untouched. PptxRasterSlidesTest pins the contract: one picture per page anchored to the full slide, picture bytes equal to the independently encoded session.toImages output at the same DPI, and the default mode still emitting vector shapes.
The viewer-ascent formula lived twice — in the render environment and, line for line, in the geometry-test mirror — so the geometry gate only proved the two copies agreed. PptxViewerMetrics.ascentPoints is now the single resolver both sides call, and the anti-tautology check is a hand-computed constant pinned in PptxFontMappingTest (Arial hhea ascent: 22pt x 1854/2048 = 19.916015625pt exactly). Raster-slide mode caps the resolution at 600 DPI — every page is held in memory during the render, so an unbounded value died later as an opaque OutOfMemoryError inside PDFBox — and its javadoc now states the memory profile and that hyperlinks, bookmarks, and custom fragment handlers do not apply to raster slides. Fully-qualified names in the raster path replaced with imports.
DemchaAV
force-pushed
the
feature/pptx-raster-slides
branch
from
July 17, 2026 10:01
705df99 to
46ce727
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The vector PPTX backend guarantees identical geometry, but glyph rasterization ultimately belongs to the viewer's font engine — a deck opened on a machine without the document fonts (or with embedding-restricted fonts) renders substitute glyphs. Some decks must look pixel-identical to the PDF/PNG output everywhere, and are happy to pay with editability.
What changed
PptxFixedLayoutBackend.Builder.rasterSlides(int dpi)(new,@since 2.1.0): raster-slide mode. Every page renders throughPdfFixedLayoutBackend.renderToImagesat the given DPI and lands as one full-slide PNG picture anchored to the exact slide bounds — a pixel-exact copy of the PDF/PNG output in.pptxform.Verification
./mvnw -B -ntp test -pl :graph-compose-render-pptx -am→ BUILD SUCCESS, render-pptx suite 26 → 28 tests.PptxRasterSlidesTestpins the contract: one picture per page across a page break, anchored at (0, 0, canvasWidth, canvasHeight); picture bytes equal the independently encodedsession.toImagesPNG at the same DPI (byte-for-byte); and the default mode still emits vector shapes (no pictures).Notes
toImagesembedded-font fix (fix(pdf): rasterize embedded fonts correctly in toImages #406) — this branch is stacked on the text-fidelity branch (feat(pptx): text fidelity — paragraphs, chips, inline graphics, font embedding #407), which is stacked on fix(pdf): rasterize embedded fonts correctly in toImages #406. Merge order: fix(pdf): rasterize embedded fonts correctly in toImages #406 → feat(pptx): text fidelity — paragraphs, chips, inline graphics, font embedding #407 → this.Lane: canonical (document.backend.fixed.pptx) — additive backend option; vector path untouched.