Releases: phax/ph-pdf-layout
v8.3.2
ph-pdf-layout-richtext: added inline background-color markup —{bg:#rrggbb}…{bg}fills a rectangle behind the wrapped run. Two vertical-extent modes selected by an optional qualifier:{bg:#rrggbb}/{bg:tight:#rrggbb}— tight (default): per-segment box sized to the segment's own font, anchored on its (possibly sub/superscript-shifted) baseline; the highlight follows the visible glyphs.{bg:line:#rrggbb}— line-height: box sized to the line's full slot using the unshifted baseline, so the highlight stays a single uniform rectangle across sub/superscript and is contiguous across wrapped lines.- Backgrounds are painted before the glyphs and the existing post-text decorations (underline, hyperlink, anchor); they compose with bold / italic / colour / underline / sub-superscript inside the span.
- Internally: new
PLBackgroundAnnotation(anIPLRichTextAnnotation) plusEPLBackgroundExtentenum (TIGHT,LINE_HEIGHT); newBackgroundFactoryinPLMarkupCharacters; pre-text fill pass added inPLRichText's render loop.
- Added the missing MIT license from the original pdfbox-layout in the richtext module
Full Changelog: ph-pdf-layout-parent-pom-8.3.1...ph-pdf-layout-parent-pom-8.3.2
v8.3.1
ph-pdf-layout-richtextmarkup syntax is now Markdown / CommonMark style — breaking change vs v8.3.0:- Bold is
**bold**(was*bold*). - Italic is
*italic*or_italic_— both Markdown forms are accepted (was_italic_only). ***foo***toggles bold and italic together.__underline__is unchanged, but differs from CommonMark: CommonMark uses__as alternate bold; here__stays reserved for underline because there is no standard Markdown for underline.- Line breaks now follow CommonMark inline semantics: a bare
\n/\r\nis a soft break (rendered as a single space and word-wrapped). A hard line break requires either two-or-more trailing spaces before the line ending, or a backslash immediately before the line ending. - Backslash escape now applies to the new markers too:
\*,\**,\_,\__. - Internally: new
IPLMarkupToken.SoftBreak; newHARD_BREAKfactory; newITALIC_UNDERSCOREfactory inPLMarkupCharacters;BOLDregex gained a(?!\*)lookahead so it cooperates with italic in***…***. All affected unit tests and pixel-diff baselines have been updated; the rendered output of the existing markup tests is byte-identical to v8.3.0 once the new escape-demo line is taken into account.
- Bold is
Full Changelog: ph-pdf-layout-parent-pom-8.3.0...ph-pdf-layout-parent-pom-8.3.1
v8.3.0
- New optional module
ph-pdf-layout-richtextproviding multi-style runs in a single paragraph, plus inline links, anchors, underline, sub/superscript and a Markdown-style markup parser.
**Markup grammar, regex catalog and split algorithm are a port of Ralf Stuckert's pdfbox-layout (MIT) — see the "Rich text" section above for full credit.
** Includes a newPLRichTextblock-level element and aPLRichTextBlockshelper for paragraph/bullet/numbered-list block sequences.
What's Changed
Full Changelog: ph-pdf-layout-parent-pom-8.2.0...ph-pdf-layout-parent-pom-8.3.0
v8.2.0
- Added split-fragment tracking on
IPLObject:getOriginalID(),isSplitFragment()andisFirstFragment().
When an element is split across pages (e.g. a longPLVBox,PLTextorPLTable), the resulting fragments still carry the unsplit ancestor's ID viagetOriginalID(), andisFirstFragment()identifies the top-most slice.
This is the foundation for upcoming table-of-contents and bookmark support, where callers need to know on which page a user-facing element first appeared. - Added per-element render callback: new
IPLRenderListener, settable viaPLPageSet.setRenderListener(...), fires after every element renders (including nested children) with the fullPageRenderContext. PageRenderContextnow exposes page indices (getPageSetIndex,getPageSetPageIndex,getTotalPageIndexand their counts), matching the names already used byPagePreRenderContext.- New
PLRenderedElementCollectorhelper consumes the listener and produces an ordered map from each element's original ID to its first-appearance page and coordinates - the natural input for building a TOC or PDF outline. - Added
PLOutlineBuilderfor generating PDF outlines (bookmarks). Declare a nested entry tree of(title, elementID)pairs, register the builder as both render listener and document customizer, and the resulting PDF opens with a clickable bookmark tree pointing at the rendered positions. Supports grouping nodes without destinations and tolerates missing element references. - Added named-anchor support: new
IPLHasAnchorNameinterface on every renderable element exposessetAnchorName(String). When set, the rendering pipeline registers a PDF named destination at the element's top-left, addressable via URL fragments (mypdf.pdf#section1), bookmarks, or internal links. Duplicate anchor names are logged as a warning and the first registration wins. - New
PLAnchorelement - a zero-size marker for inserting an anchor at an arbitrary position in the document flow. - Added internal-link support: new
PLInternalLinkwraps another element and creates a clickable PDF link annotation that jumps to a named anchor viaPDActionGoTo+PDNamedDestination. Forward references work because resolution happens at PDF read time. Extracted common link-annotation logic (rectangle, border, color) fromAbstractPLExternalLinkinto a sharedAbstractPLLinkBase; external-link behaviour is preserved byte-for-byte.
Full Changelog: ph-pdf-layout-parent-pom-8.1.2...ph-pdf-layout-parent-pom-8.2.0
v8.1.2
- Security: dropped
SerializablefromPreloadFont(and its innerEncodedCodePoint) to remove a CWE-502 deserialization gadget surface.
Note: theinstanceof IFontResourceguard previously present inreadObjectran only after the foreign class had already been instantiated. - Security:
AbstractPLExternalLink.setURI(String)now validates the URI scheme against an allowlist
(http,https,mailto,tel,ftp,ftpsby default).
Dangerous schemes such asjavascript:,file:,data:,vbscript:are rejected withIllegalArgumentException.
The active set can be replaced viasetAllowedURISchemes(ICommonsSet); supplying an empty set restores the previous unfiltered behavior LoadedFontis now@ThreadSafe: the previously misleading@Immutablelabel has been replaced and the per-codepoint caches are
guarded by aSimpleReadWriteLockwith a fast/slow path pattern.PLStreamImagenow caps the number of bytes read from the input stream (defaults to 64 MiB).
Override globally viaPLStreamImage.setDefaultMaxImageSize(int)or per instance viasetMaxImageSize(int).
Reading aborts withIOExceptiononce the cap is exceeded.- Documentation: clarified the trust boundary of
IPDDocumentCustomizerandIXMPMetadataCustomizer- both grant full mutation access to
the document/metadata and must only be supplied from trusted code.
Full Changelog: ph-pdf-layout-parent-pom-8.1.1...ph-pdf-layout-parent-pom-8.1.2
v8.1.1
- Updated to PDFBox 3.0.7
- Removed OSGI bundling
- Fixed thread-safety issue with preload Standard 14 fonts. See #65 - thx @andreasa-winenet
What's Changed
- Bump org.apache.pdfbox:pdfbox-examples from 3.0.6 to 3.0.7 in the maven group across 1 directory by @dependabot[bot] in #63
- [#65] Use Standard14Fonts.FontName instead of PDType1Font instances in PreloadFont. by @andreasa-winenet in #66
New Contributors
- @dependabot[bot] made their first contribution in #63
- @andreasa-winenet made their first contribution in #66
Full Changelog: ph-pdf-layout-parent-pom-8.1.0...ph-pdf-layout-parent-pom-8.1.1
ph-pdf-layout 8.1.0
- Updated to PDFBox 3.0.6
- Updated to ph-commons 12.1.0
- Using JSpecify annotations
Full Changelog: ph-pdf-layout-parent-pom-8.0.0...ph-pdf-layout-parent-pom-8.1.0
ph-pdf-layout 8.0.0
- Requires Java 17 as the minimum version
- Updated to ph-commons 12.0.0
Full Changelog: ph-pdf-layout-parent-pom-7.4.2...ph-pdf-layout-parent-pom-8.0.0
ph-pdf-layout 7.4.2
- Added methods
PageLayoutPDFD.setCustom(Leading|Trailing|Total)PageCountto allow for page count customization. See #58 - thx @xxs3315
Full Changelog: ph-pdf-layout-parent-pom-7.4.1...ph-pdf-layout-parent-pom-7.4.2
ph-pdf-layout 7.4.1
- Added support for rounded edges on
PLBoxandPLText. See #48 - thx @marco-de-angelis
What's Changed
New Contributors
Full Changelog: ph-pdf-layout-parent-pom-7.4.0...ph-pdf-layout-parent-pom-7.4.1