I have a barcode that I am dynamically generating, and want to pass to a gsp that will later become a pdf. I do not need to persist the barcode for any of my own purposes, and would like to simply pass the image from the controller to the gsp.
Is there a way to render an image that is passed as a variable rather than specifying a src?
Thanks in advance.
EDIT:
Since I am generating the pdf from the gsp, I am flushing the output stream of the response then, and therefore cannot do it with the image also, or I get an error.
Furthermore, using javascript/jQuery does not work since the page is never rendered directly by the browser.
It may look like the only option I have is to persist the images temporarily somewhere, and then delete them…
I answered a similar question recently, perhaps its answer will work for you. I’ll paste a portion of it here. It’s basically Oded’s “outside of this…” suggestion.
You could then access your image in the src of an tag like this:
This answer seems to fit the last comment you made on the question (about a similar solution using PHP).