danfickle / danfickle/openhtmltopdf
RFC: optimize font and image loading
- Dominant language
- Java
- Stars
- 2.2k
- Forks
- 423
- PR merge metrics
- No merged PRs in 30d
Description
Hi @danfickle , currently I'm looking at the possibility to improve the memory profile of this library by optimizing the loading of the fonts and images when they are loaded by the `PdfBoxUserAgent`.
My plan is to expand `FSStream` by exposing 2 new methods:
`boolean hasFile()` and `File getFile()` and then modifying/adding the corresponding code. (note: as we are now using java8, I can keep the retro-compatibility by defining them as default methods).
This way, I could implement a custom `FSStream` that is able to fetch the data remotely, cache them locally as a File, and then use the appropriate constructors for the Font and Image loading that accepts File, thus avoiding to load the whole resource in memory.
What do you think? Is that an acceptable plan that you can accept as a pull request?
(And I guess I can modify the default cases if the `PdfBoxUserAgent` is able to detect that a resource is a File too)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.