Repository navigation
Add a stationery plan: templates per page range plus a default - #9
Merged
Merged
Conversation
PdfStationery describes which background goes behind which pages, and PdfEditPlan.ApplyStationery records it as one operation that expands to the underlay layers the editor already writes. Assignments are tried last first, a page no assignment covers gets the default, and AssignNone opts a range out. A one-page template repeats across its range; a multi-page template maps one page for one page, and a range that reaches past it is refused when the plan runs. The PDF/A-1b no-transparency rule the overlay path already enforces applies to stationery too. Fourteen tests pin the mapping, the default, the opt-out, value semantics and the refusal; the manual, the parity record and a stationery example describe it. Refs #6.
8 tasks
Six tests named after the checklist in the issue prove, end to end, that stationery applies per page and per range, fills the rest from a default, supports a multi-page content document, keeps every page size and every letter baseline, preserves the template's vector and text operators, and writes a valid document with no image XObject to show for rasterization. All six pass on net10.0 and net11.0; the full suite is 1185 tests.
The release checklist G3 refuses a version whose notes do not exist, so the public addition this branch already carries is written down before the release commit: PdfStationery, PdfEditPlan.ApplyStationery, the underlay form XObject and the range/default rules, with the manual and the acceptance tests named.
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.
Summary
Adds a stationery plan on top of the underlay layer the editor already writes, closing the range/default gap in #6.
PdfStationery(src/SharpCorePDF.Domain/ValueObjects/PdfStationery.cs): an immutable mapping of templates toPageRanges plus a default;Assign,AssignDefault,AssignNone,ResolveForPage,Validate.PdfEditPlan.ApplyStationery(...)records it as onePdfStationeryOperation(PdfEditOperationKind.ApplyStationery = 25), so page numbers resolve against the document state at that point in the plan.PdfEditEngine.Pages.cs,PdfEditEngine.Sources.cs), so content streams are untouched and nothing is rasterized.AssignNoneopts a range out. A one-page template repeats; a multi-page template maps one page for one page and a range that reaches past it is refused at run time.PDF/A-1brefuses a translucent or blended stationery, matching the existing overlay rule.Acceptance criteria (#6)
Each criterion has a test named for it in
PdfDocumentEditorTests.StationeryAcceptance.cs:Acceptance_criterion_1_applies_different_stationery_to_pages_and_rangesAcceptance_criterion_2_applies_default_stationery_to_the_remaining_pagesAcceptance_criterion_3_supports_a_multi_page_content_pdfAcceptance_criterion_4_preserves_page_dimensions_and_content_positioningAcceptance_criterion_5_preserves_vector_graphics_and_selectable_textAcceptance_criterion_6_produces_a_valid_pdf_without_rasterizationTests
PdfDocumentEditorTests.Stationery.csand 6 acceptance tests (one per criterion above).net10.0andnet11.0.PdfStationery.cs: 100% (survivors read and killed).stationeryexample output with the repo's pikepdf/qpdf tool:qpdf check: no problems, PDF 1.7, 3 pages842x595,832x595,822x5953form (vector) XObjects,0image XObjects — nothing rasterizedDocs
docs/manual/src/14-editing.mdsection "Stationery".docs/parity.mdUS2 note.stationeryscenario.Closes #6.