Skip to content

pdf: eleven settings - orientation, mixed paper, rotate, header version and the document properties - #153

Merged
donislawdev merged 2 commits into
mainfrom
pdf-settings-group-a
Sep 29, 2026
Merged

donislawdev merged 2 commits into
mainfrom
pdf-settings-group-a

Conversation

@donislawdev

Copy link
Copy Markdown
Owner

Eleven new PDF settings, and the first format with enough of them to need blocks.

Pages: orientation (portrait, landscape, mixed), page_size=mixed (a4, letter, legal, a3, a5, one a page), rotate (0, 90, 180, 270 - writes /Rotate and leaves the page upright, so a reader that ignores it shows something different from one that follows it), pdf_version (1.4, 1.7).

Document properties: title, author, subject, keywords, creator, producer, created, modified. Printable ASCII is written between brackets as before, anything else as UTF-16 with a byte order mark, so Polish letters and line breaks read back unchanged. Dates take 2024-02-29, 2024-02-29T13:45:00 or 2024-02-29T13:45:00+02:00, are checked against the calendar, are written in the zone asked for and never in the machine's, and none leaves a date out. Mixed pages in a one page document are refused rather than written uniform.

Bytes: a file made without these settings is the file the previous version made - compared against the previous binary on 300 requests (five paper sizes, 1, 2 and 24 pages, label on and off, two seeds, five sizes from below the floor to 64 KB, refusals included) and pinned by pdf_16kib. Two new golden cases pin the settings when set.

Blocks of settings: format.Property.Group. The window draws the name with the existing Subheading, tfg formats prints it in the same place, the JSON carries it, and Register refuses a block declared in two places. New stored screen: generate-pdf-settings.

Empty text box: a free text setting with no default says "not set" instead of "worked out from the size", which was untrue for the archive password as well.

Guards

  • TestEveryPdfSettingSurvivesItsReferenceTool - pdfinfo reads every setting back (fields, dates, size and turn of each page, header version), and the file with nothing set must report no author, subject, keywords, creator or modification date. Named for the reference tool job, which installs poppler.
  • TestTheMinimumStandsWhateverTheSeedIsUnderEveryDeclaredChoice - the 256 seed sweep of the minimum under every non-default choice of every format. The existing sweep runs at defaults only: a deliberately seed dependent landscape page was red here and green there.
  • TestASettingsBlockIsNamedWhereItStartsOnBothOutputs, TestABlockOfSettingsDeclaredInTwoPlacesIsRefused.

Out of this change on purpose: compression (it makes the length depend on the seed and needs its own design), PDF 2.0 (it needs a file identifier and the widths of the font's characters), and the text that runs past the right edge of an A5 page, which will be fixed together with 2.0.

🤖 Generated with Claude Code

…on and the document properties

orientation lays pages upright, wide or both in turn. page_size=mixed
walks a4, letter, legal, a3, a5, one a page, taken from the page number
rather than the seed. rotate writes /Rotate and leaves the page upright.
pdf_version writes 1.4 or 1.7. title, author, subject, keywords,
creator, producer, created and modified fill the information
dictionary: printable ASCII between brackets as before, anything else
as UTF-16 with a byte order mark, dates checked against the calendar
and written in the zone asked for, never the machine's. Mixed pages in
a one page document are refused rather than written uniform.

Defaults write exactly the old bytes: compared against the previous
binary on 300 requests, and pinned by the golden value. Two new golden
cases pin the settings when set.

A setting may name a block it belongs to (format.Property.Group). The
window draws the name with the existing Subheading, tfg formats prints
it, the JSON carries it, and Register refuses a block declared in two
places. An empty free text box without a default says "not set"
instead of "worked out from the size", which was untrue for the
archive password too.

New guards: pdfinfo reads every setting back, with a file that must
report no author as the negative control. The seed sweep of the
minimum now runs under every non-default choice of every format, not
only the defaults - a deliberately seed dependent landscape page was
red there and green in the old guard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Advanced

Run ID: c0770c3f-94c5-4c71-be57-0ff862a74ca5

📥 Commits

Reviewing files that changed from the base of the PR and between a632cd4 and 021db7b.

⛔ Files ignored due to path filters (4)
  • internal/guard/testdata/screens/catalogue.png is excluded by !**/*.png, !**/*.png
  • internal/guard/testdata/screens/generate-pdf-settings.png is excluded by !**/*.png, !**/*.png
  • web/public/formats/index.html is excluded by !**/web/public/**
  • web/public/pl/formaty/index.html is excluded by !**/web/public/**
📒 Files selected for processing (27)
  • CHANGELOG.md
  • README.md
  • internal/cli/formats.go
  • internal/format/format.go
  • internal/format/pdf/document.go
  • internal/format/pdf/info.go
  • internal/format/pdf/minimum.go
  • internal/format/pdf/page.go
  • internal/format/pdf/pdf.go
  • internal/format/pdf/properties.go
  • internal/format/pdf/settings.go
  • internal/format/registry.go
  • internal/guard/choiceseed_test.go
  • internal/guard/generatorbytes_test.go
  • internal/guard/parity_test.go
  • internal/guard/pdfsettings_test.go
  • internal/guard/properties_test.go
  • internal/guard/screenpixels_test.go
  • internal/guard/settingsgroup_test.go
  • internal/guard/testdata/generator-golden.json
  • internal/guard/testdata/screens/catalogue.xml
  • internal/guard/testdata/screens/generate-pdf-settings.xml
  • internal/gui/parts/property.go
  • internal/gui/text/locale/en.json
  • internal/gui/text/screens.go
  • web/content/en/site.json
  • web/content/pl/site.json

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…the choice sweep

CI: 50 functions nested three deep against a cap of 49 - pdfString
held a loop in a branch in a loop. The printable check and the UTF-16
writer are their own functions now. And the exhaustive linter wanted
every PropertyKind named in the sweep's switch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@donislawdev
donislawdev merged commit 9c634d5 into main Sep 29, 2026
25 checks passed
@donislawdev
donislawdev deleted the pdf-settings-group-a branch September 29, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant