Skip to content

Releases: phax/ph-pdf-layout

v8.3.2

07 Jun 20:08

Choose a tag to compare

  • 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 (an IPLRichTextAnnotation) plus EPLBackgroundExtent enum (TIGHT, LINE_HEIGHT); new BackgroundFactory in PLMarkupCharacters; pre-text fill pass added in PLRichText'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

30 May 20:57

Choose a tag to compare

  • ph-pdf-layout-richtext markup 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\n is 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; new HARD_BREAK factory; new ITALIC_UNDERSCORE factory in PLMarkupCharacters; BOLD regex 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.

Full Changelog: ph-pdf-layout-parent-pom-8.3.0...ph-pdf-layout-parent-pom-8.3.1

v8.3.0

29 May 21:37

Choose a tag to compare

  • New optional module ph-pdf-layout-richtext providing 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 new PLRichText block-level element and a PLRichTextBlocks helper 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

28 May 16:21

Choose a tag to compare

  • Added split-fragment tracking on IPLObject: getOriginalID(), isSplitFragment() and isFirstFragment().
    When an element is split across pages (e.g. a long PLVBox, PLText or PLTable), the resulting fragments still carry the unsplit ancestor's ID via getOriginalID(), and isFirstFragment() 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 via PLPageSet.setRenderListener(...), fires after every element renders (including nested children) with the full PageRenderContext.
  • PageRenderContext now exposes page indices (getPageSetIndex, getPageSetPageIndex, getTotalPageIndex and their counts), matching the names already used by PagePreRenderContext.
  • New PLRenderedElementCollector helper 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 PLOutlineBuilder for 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 IPLHasAnchorName interface on every renderable element exposes setAnchorName(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 PLAnchor element - a zero-size marker for inserting an anchor at an arbitrary position in the document flow.
  • Added internal-link support: new PLInternalLink wraps another element and creates a clickable PDF link annotation that jumps to a named anchor via PDActionGoTo + PDNamedDestination. Forward references work because resolution happens at PDF read time. Extracted common link-annotation logic (rectangle, border, color) from AbstractPLExternalLink into a shared AbstractPLLinkBase; 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

16 May 20:58

Choose a tag to compare

  • Security: dropped Serializable from PreloadFont (and its inner EncodedCodePoint) to remove a CWE-502 deserialization gadget surface.
    Note: the instanceof IFontResource guard previously present in readObject ran 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, ftps by default).
    Dangerous schemes such as javascript:, file:, data:, vbscript: are rejected with IllegalArgumentException.
    The active set can be replaced via setAllowedURISchemes(ICommonsSet); supplying an empty set restores the previous unfiltered behavior
  • LoadedFont is now @ThreadSafe: the previously misleading @Immutable label has been replaced and the per-codepoint caches are
    guarded by a SimpleReadWriteLock with a fast/slow path pattern.
  • PLStreamImage now caps the number of bytes read from the input stream (defaults to 64 MiB).
    Override globally via PLStreamImage.setDefaultMaxImageSize(int) or per instance via setMaxImageSize(int).
    Reading aborts with IOException once the cap is exceeded.
  • Documentation: clarified the trust boundary of IPDDocumentCustomizer and IXMPMetadataCustomizer - 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

16 May 11:23

Choose a tag to compare

  • 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

Full Changelog: ph-pdf-layout-parent-pom-8.1.0...ph-pdf-layout-parent-pom-8.1.1

ph-pdf-layout 8.1.0

15 Nov 23:37

Choose a tag to compare

  • 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

24 Aug 20:20

Choose a tag to compare

  • 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

08 Jul 11:49

Choose a tag to compare

  • Added methods PageLayoutPDFD.setCustom(Leading|Trailing|Total)PageCount to 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

24 Jun 11:53

Choose a tag to compare

What's Changed

New Contributors

  • @phax made their first contribution in #55

Full Changelog: ph-pdf-layout-parent-pom-7.4.0...ph-pdf-layout-parent-pom-7.4.1