# system.print.createPrintJob with File Name

**URL:** <https://forum.inductiveautomation.com/t/system-print-createprintjob-with-file-name/29071>\
**Category:** Ignition\
**Created:** [October 14, 2019, 3:03pm UTC](https://forum.inductiveautomation.com/t/system-print-createprintjob-with-file-name/29071 "2019-10-14T15:03:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [October 14, 2019, 3:03pm UTC](https://forum.inductiveautomation.com/t/system-print-createprintjob-with-file-name/29071/1 "2019-10-14T15:03:25Z")

</div>

Can a name be auto-populated (such as date/time) into the system.print.createPrintJob function? This would allow the file to be saved without using the PrintDialog popup.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 14, 2019, 5:06pm UTC](https://forum.inductiveautomation.com/t/system-print-createprintjob-with-file-name/29071/2 "2019-10-14T17:06:27Z")

</div>

Unfortunately, no. However, if you are just trying to save a snapshot of a component to a file, you can create a BufferedImage of the desired resolution, use `myComponent.paint(bufimage.getGraphics())` to render the component into the image, then use ImageIO to save the rendered image to a file.

---

<div class="post-metadata">

**Author:** ![jasonpdavid](https://avatars.discourse-cdn.com/v4/letter/j/8edcca/32.png) [@jasonpdavid](https://forum.inductiveautomation.com/u/jasonpdavid)\
**Post date:** [October 14, 2019, 5:22pm UTC](https://forum.inductiveautomation.com/t/system-print-createprintjob-with-file-name/29071/3 "2019-10-14T17:22:03Z")

</div>

Thanks @pturmel, would the resulting file have to be saved as an image type?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 14, 2019, 5:37pm UTC](https://forum.inductiveautomation.com/t/system-print-createprintjob-with-file-name/29071/4 "2019-10-14T17:37:05Z")

</div>

Yes. You might also investigate using Java’s PrintJob class yourself (a bit of a pain, iirc).

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [October 14, 2019, 7:38pm UTC](https://forum.inductiveautomation.com/t/system-print-createprintjob-with-file-name/29071/5 "2019-10-14T19:38:43Z")

</div>

If you are just looking to print screen to a file you could use something like this.  
We use it to email screenshots from the operators to support.

```auto
def saveScreenshot(twindow):
	from java.io import File
	from java.awt.image import BufferedImage
	from javax.imageio import ImageIO
	from java.awt import Robot
	from java.awt import Rectangle
	from java.awt import Toolkit
	import system
	problem = system.gui.inputBox('Enter a short description of the problem and click OK','Problem Report')
	home = system.util.getProperty("user.home")
	BufferedImage = Robot().createScreenCapture(Rectangle(Toolkit.getDefaultToolkit().getScreenSize()))
	temp = File(home + "/Documents/" + twindow + ".png");
	temp.mkdirs()
	ImageIO.write(BufferedImage, "png", temp)

```

It will create a png screenshot in the users home directory.  
You can modify it to save wherever with whatever name you want.
