Skip to content

♻️ Refactor PDF processing code to align with PDFium thread-safety and rendering best practices#1209

Open
balazs-szucs wants to merge 8 commits into
stumpapp:nightlyfrom
balazs-szucs:pdf-rework
Open

♻️ Refactor PDF processing code to align with PDFium thread-safety and rendering best practices#1209
balazs-szucs wants to merge 8 commits into
stumpapp:nightlyfrom
balazs-szucs:pdf-rework

Conversation

@balazs-szucs
Copy link
Copy Markdown
Contributor

@balazs-szucs balazs-szucs commented Jun 2, 2026

  • Resolves concurrent rendering crashes by serializing PDFium FFI calls with a global mutex lock.
  • Moves blocking page analysis tasks to a dedicated thread pool to prevent problems due to newly added Locks.
  • Improves low-resolution rendering by using configured DPI settings and preserving aspect ratios.
  • Refactors PDF stuff to use PDFium-render, and removes now (unused) pdf.rs library.

On the last point, generally, PDFIum should be much more reliable/performant than from what I can moreso a hobbyist Rust PDF library. So, using PDF.rs then to fallback PDFium, that seemed like bit of strange choice, and when I flipped them, i thought, there is very unlikely that PDFium would fail and PDF.rs would catch it, so at that point better to just remove. PDF.rs was also pulling in seemingly quite large of other deps. So, I think that's a win.

Date parsing still hacky. But it is mostly in working condition.

I am still not happy with date stuff, but otherwise this should be improvements. It's able parse in the bit more metadata (e.g., Summary/Description that was previously ignored), i have not been able to trigger segfault, but yeah bit slower overall (not a huge surprise.)

@balazs-szucs balazs-szucs changed the title ♻️ Refactor PDF processing stack to align with PDFium thread-safety and rendering best practices ♻️ Refactor PDF processing code to align with PDFium thread-safety and rendering best practices Jun 2, 2026
@balazs-szucs balazs-szucs marked this pull request as ready for review June 2, 2026 17:03
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