Please give a look at this post - https://www.vintasoft.com/forums/viewtopic.php?f=17&t=659#p2806.
Main idea is as follows:
- store as much separate images as you need,
- then use Apache FOP to compile a PDF containing all the images (FOP only needs an XSL tagged document, very similar to an HTML or XML)