Chrome-image loaded inside Chrome-pdf



  • Wondering if it's possible to load a template that using chrome-image inside a template using chrome-pdf?
    Tried using Child templates to do this but with no luck. I'm assuming this is not possible but thought I would ask.

    Thanks



  • It is possible for example using custom script

    Use beforeRender hook and render your chrome-image template
    https://jsreport.net/learn/scripts#rendering-another-template-from-script
    Put the result in base64 form to lets say req.data.myImage
    Then use normal img tag bound to the req.data.myImage.



  • Thanks... I may go that way but it will require a lot of rework.

    I'm currently generating 1-30 maps into a pdf and was trying to find a way to get the memory usage down as having that many maps at once is taxing. Was hoping to generate a few maps at a time and turn them into images as I go to free up the memory used by each map.

    Also if I remember right I think there is a limit to the number of templates you can render from script? So that may not work.



  • I'm currently generating 1-30 maps into a pdf and was trying to find a way to get the memory usage down as having that many maps at once is taxing. Was hoping to generate a few maps at a time and turn them into images as I go to free up the memory used by each map.

    That is an interesting idea. Please let us know how it ended up if you decide to try a prototype.

    Also if I remember right I think there is a limit to the number of templates you can render from script? So that may not work.

    I'm not aware there would be such a limit.


    Another possible approach with child templates... Put to the child template afterRender script which will convert the response bytes (image produced by chrome-image)
    into html <img src={...datauri base64} />. Note there is default parallel limit in child templates set to 2.



  • Ah the afterRender Idea may work I'm going to give that a try, Will let you know how it goes. Thanks!


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.