# Popup Print Script Error

**URL:** <https://forum.inductiveautomation.com/t/popup-print-script-error/61356>\
**Category:** Ignition\
**Tags:** ignition81, scripting, perspective\
**Created:** [June 29, 2022, 3:58pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356 "2022-06-29T15:58:25Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![csilk](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@csilk](https://forum.inductiveautomation.com/u/csilk)\
**Post date:** [June 29, 2022, 3:58pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/1 "2022-06-29T15:58:26Z")

</div>

I have a popup that I placed a button on it that has the following script:

```auto
job = system.print.createPrintJob(event.source.parent)
job = setShowPrintDialog(1)
job.print()

```

I would like this script to print the contents of my popup. Whenever I try to run this, I receive the following error

> File "function:runAction", line 2, in runAction AttributeError: 'com.inductiveautomation.ignition.common.script.Imm' object has no attribute 'print'

I am not sure what this error means?

Thank you

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [June 29, 2022, 4:13pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/2 "2022-06-29T16:13:21Z")

</div>

You can’t use that in perspective, the scope of this function is only Vision -

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/4/f4bc843204715d80e191f2767a71103f084c84e5.png)

[https://docs.inductiveautomation.com/display/DOC80/system.print.createPrintJob](https://docs.inductiveautomation.com/display/DOC80/system.print.createPrintJob)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 29, 2022, 5:19pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/3 "2022-06-29T17:19:08Z")

</div>

To add to what @bkarabinchak.psi said, there is currently no way to send a print job with perspective, that I am aware of.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [June 29, 2022, 6:12pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/4 "2022-06-29T18:12:54Z")

</div>

Perspective clients are web browser sessions. Browsers don’t allow websites to push a print job.  
Think of the fun that could be had by the black hats if that were possible.

You could consider having the button run the print job on the gateway and direct it to the local printer. There should be some posts on the forum detailing how to do that.

---

<div class="post-metadata">

**Author:** ![csilk](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@csilk](https://forum.inductiveautomation.com/u/csilk)\
**Post date:** [June 29, 2022, 6:44pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/5 "2022-06-29T18:44:12Z")

</div>

Is this feature only for printing reports, or can it print an entire popup?

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 29, 2022, 6:51pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/6 "2022-06-29T18:51:20Z")

</div>

The function you’re attempting to use, as @bkarabinchak.psi has pointed out, is only available in a ‘Vision Client’. You have tagged this topic as perspective, and so we are assuming you are attempting to use this in a Perspective based application.

The function when used in a Vision Client can be used to print a Component.

The script you have provided will not work in a Perspective application. Not only is the `system.print.createPrintJop()` function not available, but neiter is `event.source.parent`.

On top of that, but the script as provided has an error, as you are overwriting the variable `job` with `setShowPrintDialog(1)` in the second line.

---

<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:** [June 29, 2022, 6:53pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/7 "2022-06-29T18:53:54Z")

</div>

Your users will have to manually request to print a page or a selection from their browser’s menu. You cannot automate this–it is a browser security violation.

---

<div class="post-metadata">

**Author:** ![csilk](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@csilk](https://forum.inductiveautomation.com/u/csilk)\
**Post date:** [June 29, 2022, 7:04pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/8 "2022-06-29T19:04:17Z")

</div>

Yes, I understand that now. I was replying to @Transistor since he said that there was a way to print to the gateway.

As of now, is there any way to “print” a popup in perspective? Based on what I am seeing, it does not seem possible. If it is not possible, is there a way that I can save a popup, locally, as a PDF?

Thank you.

---

<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:** [June 29, 2022, 7:06pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/9 "2022-06-29T19:06:08Z")

</div>

> [@csilk](#):
>
> that I can save a popup, locally, as a PDF?

No, the closest you can get is to run a report via script and push a download of the report's PDF (via `system.perspective.download`). Your user would have to accept the download, open it, and print it.

---

<div class="post-metadata">

**Author:** ![csilk](https://avatars.discourse-cdn.com/v4/letter/c/9e8a1a/32.png) [@csilk](https://forum.inductiveautomation.com/u/csilk)\
**Post date:** [June 29, 2022, 7:27pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/10 "2022-06-29T19:27:00Z")

</div>

I apologize, but maybe I should have been more clear. I have a popup that does not have the report viewer component. In a perfect world, the user would be able to click a button and the popup will print as a PDF and save to their local PC. Basically, doing a “print screen” function of just the popup that is opened. Based on what I am finding and what you have said, doing a print command is not possible…

I looked into the command `system.perspective.download` like you suggested, and I looked at the example of it, but I am not sure how/where I would call the popup to be downloaded in the script?

---

<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:** [June 29, 2022, 7:33pm UTC](https://forum.inductiveautomation.com/t/popup-print-script-error/61356/11 "2022-06-29T19:33:06Z")

</div>

You _ **cannot** _ print your Perspective popup.

The closest thing you can do is create a report that contains the same data as your popup and trigger a download of that.

You _ **cannot** _ print your Perspective popup.
