Repository navigation
Print a poster whole on one page when no width fits its content - #177
Merged
Merged
Conversation
The page script widens a poster until its content fits the paper, up to 4000 px. Pictures as wide as their column grow with the page, so a poster with several large ones fits at no width. It was then given the paper's height at 4000 px and its content overflowed: Chrome printed the rest on a second page, and --pdf, which prints page 1 only, cut it off. Now the script takes the width whose content is least tall for it, lets the poster be as tall as its content, and on beforeprint scales it to fit the page, centred, with margins at the sides. It marks the poster data-squeezed and warns in the console. Posters that fit are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QshqEpLDivU1Yp8ZGZGsEE
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.
Problem
A poster's page script widens its layout until the content fits the paper's proportions, up to 4000 px. Pictures as wide as their column grow with the page, so a poster with several large pictures fits at no width.
The script then kept 4000 px, gave the poster the paper's height and let the content overflow:
py-doc poster --pdfprints page 1 only, so the bottom of the poster, footer included, was silently cut off.Change
src/py_doc/poster.py, the page script:beforeprint, the poster is scaled to fit the page and centred, with margins at the sides. This covers Chrome's print dialogue and--pdfalike.data-squeezedand warns in the browser console.The posters guide and the writing guide say what happens and what to do about it. The new sentences keep within the Vale sentence limit.
Testing
ruff checkandruff format --checkare clean.--pdfitself was not run, because it needs the tool container.poster_pdf.jstakes the same steps the test does: print media,beforeprint, then the PDF.Not done
The warning shows only in the browser console. Reporting it in the terminal during
--pdfwould mean passing output back from the container.Generated by Claude Code