Skip to content

Add lazy stream loading to reduce memory for large PDFs#1281

Open
EdwardBlair wants to merge 1 commit intoUglyToad:masterfrom
EdwardBlair:feature/lazy-stream-data
Open

Add lazy stream loading to reduce memory for large PDFs#1281
EdwardBlair wants to merge 1 commit intoUglyToad:masterfrom
EdwardBlair:feature/lazy-stream-data

Conversation

@EdwardBlair
Copy link
Copy Markdown

@EdwardBlair EdwardBlair commented Apr 16, 2026

Adds ParsingOptions.LazyLoading (off by default) which defers reading stream bytes until they're actually needed. With this on, page.GetImages() gives you width, height, bounding box etc without loading the image data into memory - the bytes only get read if you actually access them.

For the file path overload this means using a FileStream instead of File.ReadAllBytes so the data stays on disk. Should help with #1171 where big images cause OOM on cheap nodes.

This could also work as a foundation for #980 - the lazy stream infrastructure means a future capabilities enum could skip processing images/paths entirely and the byte data would never leave disk.

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