Skip to content

Morph.PDFium 1.4.3; convert pages in parallel - #44

Merged
SimonCropp merged 1 commit into
mainfrom
morph-pdfium-1.4.3
Oct 22, 2026
Merged

SimonCropp merged 1 commit into
mainfrom
morph-pdfium-1.4.3

Conversation

@SimonCropp

Copy link
Copy Markdown
Member

Picks up Morph.PDFium 1.4.3 and switches Convert to its new ProcessPages.

Changes

  • Morph.PDFium 1.4.2 → 1.4.3.
  • Convert rendered and read pages one at a time, loading each page twice (once for its text, once inside document.RenderPage). It now calls document.ProcessPages(indices, …): each wanted page is loaded once, rendered with page.Render(dpi) and read, with the pages spread across cores. Results come back in page order and conversion.AddPage is still called sequentially from the converting thread, so nothing in PagedConversion needs to be thread-safe. IncludeImages/IncludeText gating and page-subset behaviour are unchanged.

Effect

Measured in Morph.PDFium's benchmarks on a 149-page text document, the text + render shape this converter uses:

96 DPI 200 DPI
Before (1.4.2 encoder, sequential loop) ~2.8 s ~7 s
1.4.3 encoder, sequential loop 1.28 s 3.35 s
1.4.3 + ProcessPages (this PR) 0.72 s 1.45 s

1.4.3 also writes text pages as grayscale PNGs (about 60% smaller). They are different bytes but SSIM-identical, so no .verified.png files change — all 25 tests pass as they are.

Convert rendered and read pages one at a time, loading each page twice
(once for its text, once inside RenderPage). It now goes through
PdfiumDocument.ProcessPages: each wanted page is loaded once, rendered
with page.Render and read, with the pages spread across cores; the
results come back in page order and are added to the conversion from
this thread, so PagedConversion need not be thread safe.

Morph.PDFium 1.4.3 also brings grayscale PNGs for text pages, pooled
render buffers and a per-image filter choice. Measured on a 149 page
text document, converting the whole document went from 1.28 s to 0.72 s
at 96 DPI and 3.35 s to 1.45 s at 200 DPI. The PNGs are different bytes
but compare equal under SSIM, so no snapshots change.
@SimonCropp SimonCropp added this to the 2.2.1 milestone Oct 22, 2026
@SimonCropp
SimonCropp merged commit 85fafe5 into main Oct 22, 2026
6 checks passed
@SimonCropp
SimonCropp deleted the morph-pdfium-1.4.3 branch October 22, 2026 02:44
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