Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #27052

    we have implemented our custom ResourceProvider

    In case, we are including large resources, it will be better to provide resources as InputStream instead of byte array (to use less memory). Furthermore for resources such as file hosted on the file system, it is not efficient to load them as byte array instead of directly including them into the resulting PDF.

    What do you think of providing a new ResourceProvider that allow custom classes to override :

    InputStream getResourceAsStream(String resource, boolean debugOn)

    instead of:

    byte[] getResourceAsBytes(String resource, boolean debugOn)



    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”.

Viewing 2 posts - 1 through 2 (of 2 total)

The forum ‘General questions / FAQ’ is closed to new topics and replies.