HTML to PDF / DOCX / RTF Java converter library › Forums › PD4ML v3 Archived Forums (Read Only) › General questions / FAQ › ResourceProvider: replace byte array by inputstream › Re: Re: ResourceProvider: replace byte array by inputstream
We plan to optimize resource loading / caching in totally refactored v4.x
Your proposal would make sense only by attachment embedding. Other type of loaded resources do not win a lot:
CSS – should be instantly loaded and parsed anyway
images – PD4ML does not trust a file extension. It always loads an image and scans its bytes to determine image file type and dimensions. If explicitly configured, after that it unloads the image to a temp directory to free up RAM.
Despite the impression, that it allocates a lot of memory because of images and other resources, it is not always true. A specifics of HTML rendering is that it should allocate a number of Java objects even for a single standalone whitespace. So parsed HTML (with layouting info) is the main “RAM eater”.