# Printing a Root Container into PDF

**URL:** <https://forum.inductiveautomation.com/t/printing-a-root-container-into-pdf/11975>\
**Category:** Ignition\
**Created:** [July 27, 2016, 6:24am UTC](https://forum.inductiveautomation.com/t/printing-a-root-container-into-pdf/11975 "2016-07-27T06:24:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmdalisay](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@rmdalisay](https://forum.inductiveautomation.com/u/rmdalisay)\
**Post date:** [July 27, 2016, 6:24am UTC](https://forum.inductiveautomation.com/t/printing-a-root-container-into-pdf/11975/1 "2016-07-27T06:24:42Z")

</div>

Hi!  
I need to be able to print a root container into PDF. I have come across the function  
system.print.createImage

[https://support.inductiveautomation.com/usermanuals/ignition/index.html?system\_print\_printtoimage.htm](https://support.inductiveautomation.com/usermanuals/ignition/index.html?system_print_printtoimage.htm)

However, I don’t have any idea on how to use javax.imageio.ImageIO. Can someone please advice me on how to do this?

Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Jhahn](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@Jhahn](https://forum.inductiveautomation.com/u/Jhahn)\
**Post date:** [July 27, 2016, 12:43pm UTC](https://forum.inductiveautomation.com/t/printing-a-root-container-into-pdf/11975/2 "2016-07-27T12:43:52Z")

</div>

The way I understand it is that function will save the snapshot of the current container. If you add a button and change the action to that function it will allow you to save that image.

If what you are wanting to do is have a picture of your container. Press Print Screen ( it may say Prt Scrn) its usually in the top right hand corner of the keyboard. Then open your imaged editor of choice and crop the picture down.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [July 27, 2016, 10:06pm UTC](https://forum.inductiveautomation.com/t/printing-a-root-container-into-pdf/11975/3 "2016-07-27T22:06:29Z")

</div>

Assuming the ultimate goal is a printout that looks like a window, I would use the [system.print.createPrintJob](https://docs.inductiveautomation.com/display/DOC/system.print.createPrintJob) scripting function (see the example code on the page), and then use a [‘Print to PDF’](http://www.digitaltrends.com/computing/print-pdf-windows/) driver to save the output. This should result in output that looks like the attached:

---

<div class="post-metadata">

**Author:** ![rmdalisay](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@rmdalisay](https://forum.inductiveautomation.com/u/rmdalisay)\
**Post date:** [July 28, 2016, 5:36am UTC](https://forum.inductiveautomation.com/t/printing-a-root-container-into-pdf/11975/4 "2016-07-28T05:36:25Z")

</div>

Hi. Thanks for your responses.  
Sorry for not being so clear with my question.

What I am hoping to do is to have a button, which is, when pressed, will create a print screen of a container and convert them to bytes so that I can save it as a BLOB field in our database.  
Simultaneously, it will open a window browser for me to be able to save the file into PDF in a chosen location.

The part in which I’m having confusion is on how I can use javax.imageio.ImageIO to turn a a Java BufferedImage into bytes for BLOB. I am able to use this function `ImageIO.write(createImage(getParentWindow(event).parent), 'jpg', baos)` to create a jpg, but I am clueless on the code I should use to convert it to bytes.

Thank you in advance.
