Skip to content

Prepare 0.3.0: Word export on php-docx 1.18, and the first Packagist release - #6

Merged
serpentblade merged 3 commits into
mainfrom
release-0.3.0
Oct 28, 2026
Merged

serpentblade merged 3 commits into
mainfrom
release-0.3.0

Conversation

@serpentblade

Copy link
Copy Markdown
Contributor

Summary

Word export on php-docx 1.18 (sections and floating pictures landed upstream in php-docx#10):

  • Sections. Each run of pages with the same size, margins, header, footer and layer pictures becomes its own Word section, so a later page keeps its own setup and header instead of taking the first page's. Pages that look alike stay one section joined by page breaks, so the existing examples come out the same. No blank page at a section break, and a section without a header no longer shows the previous one's.
  • Layer pictures. An image, QR code or SVG in a page background (before anything else in it), or alone in an overlay place, becomes a floating picture at the position the PDF draws it, repeated on every page through the section's header. Other layer content and PDF templates are still dropped and reported.
  • Caveat: Word draws header content behind the body, so an overlay picture sits behind body text rather than over it. Documented in the README and the Word export guide.
  • Removed the page-size patch: php-docx now writes any page size.

0.3.0 release prep:

  • Core's branch alias is 0.3.x-dev; Laravel and DOCX require papercut/core ^0.3.
  • CHANGELOG section renamed to [0.3.0] - unreleased, noting 0.1 and 0.2 were never published.
  • READMEs and the site say 0.3 and drop "not yet published"; the Laravel README's path-repository install steps become composer require.
  • The papercut vendor name is free on Packagist.

How it was checked

  • Core, Laravel and DOCX suites and PHPStan pass; new tests cover sections and layer pictures.
  • Positions of layer pictures were compared with core's Paginator output (the PDF's own layout) across 20+ cases (widths, percentages, margins, padding, borders, alignment, anchors, height-only, max-width). All match.
  • A review pass found six issues (padding/border, alignment in a sized place, unsized-place widths, percentage plus margin, a leading page break at a section break, empty places); all fixed in the second commit, with tests.
  • The examples and a three-section document with both layers pass the OOXML schema check. LibreOffice lays the latter out on the same four pages as the PDF.
  • One behaviour change outside layers: a percentage width with margins in the body is now a share of the space after the margins, as the PDF does it.

After merging

  1. Put the date on ## [0.3.0] in CHANGELOG.md and add a fresh ## [Unreleased].
  2. git tag -s v0.3.0 -m "Papercut 0.3.0" && git push origin main v0.3.0 — release.yml runs every suite, splits and tags the three packages, and creates the GitHub release.
  3. Submit papercut-core, then papercut-laravel and papercut-docx, at https://packagist.org/packages/submit.
  4. Check in a scratch project: composer require papercut/core papercut/laravel papercut/docx.

🤖 Generated with Claude Code

serpentblade and others added 3 commits October 28, 2026 14:22
…ictures

php-docx 1.18 writes several sections and floating pictures.

- Each run of pages with the same size, margins, header, footer and layer
  pictures becomes its own Word section, so a later page keeps its setup
  and headers instead of taking the first page's. Pages that look alike
  stay one section joined by page breaks, so existing output is unchanged.
  No blank page at a section break, and a section without a header or
  footer no longer shows the previous section's.
- Images, QR codes and SVG in a background or overlay layer float from the
  section's header at the positions the PDF draws them (checked against
  the PDF layout for widths, margins, alignment, anchors and percentages),
  so they repeat on every page. Other layer content is still dropped and
  now reported at its own path.
- The page-size patch is gone: php-docx writes any page size.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
From review of the floating-pictures change, each checked against the
PDF layout:

- Padding and border on a layer picture: the picture sits inside them,
  and the next background picture below the whole box. Word can't draw
  the border or background, so they are reported as dropped.
- A picture aligns inside an overlay place that has a width.
- An overlay place without a width is as wide as its picture asks
  (width, else natural size), so height-only, max-width and percentage
  widths come out as in the PDF.
- A percentage width is of the space left after the margins, in the
  body as well as in layers.
- An empty overlay place is ignored instead of reported (strict mode
  threw on it).
- No blank page when a page opens with a page break, at a section
  break or within one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Core's branch alias is 0.3.x-dev; Laravel and DOCX require
  papercut/core ^0.3 (Laravel's dev and path pins for DOCX too).
- CHANGELOG: the unreleased 0.2.0 section becomes 0.3.0, noting that
  0.1 and 0.2 were never published. The date goes in at tag time.
- READMEs and the site say 0.3 and drop "not yet published"; the
  Laravel README's path-repository install steps give way to
  composer require. Before 1.0, a minor version may change the API.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@serpentblade
serpentblade merged commit a300454 into main Oct 28, 2026
11 checks passed
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