# Button - print different component

**URL:** <https://forum.inductiveautomation.com/t/button-print-different-component/83310>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [December 19, 2023, 1:50pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310 "2023-12-19T13:50:26Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 1:50pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/1 "2023-12-19T13:50:26Z")

</div>

I would like to print a component from another component. Does anyone know if there is a way to request print action of a different component? Specifically, in the onActionPerformed event of a button. I know I can request print action for the page / view / button.

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 2:52pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/2 "2023-12-19T14:52:41Z")

</div>

Does system.print.createPrintJob work in perspective? [https://docs.inductiveautomation.com/display/DOC81/system.print.createPrintJob](https://docs.inductiveautomation.com/display/DOC81/system.print.createPrintJob)

---

<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:** [December 19, 2023, 3:08pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/3 "2023-12-19T15:08:53Z")

</div>

No, that is a Java Swing operation.

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 3:12pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/4 "2023-12-19T15:12:23Z")

</div>

Is it possible to trigger a request print action of componentA from an event of componentB (perspective) ?

---

<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:** [December 19, 2023, 3:15pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/5 "2023-12-19T15:15:39Z")

</div>

The documentation suggests not.

[https://docs.inductiveautomation.com/display/DOC81/Component+Events+and+Actions#ComponentEventsandActions-RequestPrintAction](https://docs.inductiveautomation.com/display/DOC81/Component+Events+and+Actions#ComponentEventsandActions-RequestPrintAction)

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 3:20pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/6 "2023-12-19T15:20:22Z")

</div>

Interesting...would be nice.

---

<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:** [December 19, 2023, 3:20pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/7 "2023-12-19T15:20:51Z")

</div>

You should make a [feature request](https://ideas.inductiveautomation.com/).

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 3:21pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/8 "2023-12-19T15:21:54Z")

</div>

Sounds like a good idea.

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 3:27pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/9 "2023-12-19T15:27:13Z")

</div>

If anybody else wants this feature - [Feature Request](https://inductiveautomation.canny.io/ignition-features-and-ideas/p/perspective-request-print-action-for-different-component)

---

<div class="post-metadata">

**Author:** ![YF129701](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/yf129701/32/60498_2.png) [@YF129701](https://forum.inductiveautomation.com/u/YF129701)\
**Post date:** [December 19, 2023, 3:37pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/10 "2023-12-19T15:37:08Z")

</div>

What if you create a message handler that you call from the button click, but the message would live on the component you want to print? I think that should work but I never tested this setup before.

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 3:41pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/11 "2023-12-19T15:41:15Z")

</div>

I will try it out and reply back.

---

<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:** [December 19, 2023, 3:48pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/12 "2023-12-19T15:48:07Z")

</div>

~~There is no scripting equivalent of the request print action. It has to be user-initiated. So a message handler cannot fire it.~~

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 19, 2023, 4:34pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/13 "2023-12-19T16:34:01Z")

</div>

> [@HelloWorld](#):
>
> Is it possible to trigger a request print action of componentA from an event of componentB (perspective) ?

This is absolutely possible, though the script editor doesn't provide the hinting that you can do it.

```python
self.getSibling("SiblingNameHere").requestPrint("component", "FileName")

```

---

<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:** [December 19, 2023, 4:35pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/14 "2023-12-19T16:35:44Z")

</div>

Cool! And no message handler needed for the simple case. TIL.

Can a pointer to this be added to the documentation for the action?

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [December 19, 2023, 4:38pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/15 "2023-12-19T16:38:20Z")

</div>

Documentation can be found [here](https://docs.inductiveautomation.com/display/DOC81/Perspective+Component+Methods#:~:text=self.removeContextMenu()-,Requesting%20Print,-The%20following%20feature), though we were literally looking at this very documentation last week because it doesn't meet our (my) standards and there is an internal ticket open to improve the example.

Looking at the documentation for the analogous [Action](https://docs.inductiveautomation.com/display/DOC81/Component+Events+and+Actions#ComponentEventsandActions-RequestPrintAction:~:text=selected%20event%20triggers.-,Request%20Print%20Action,-The%20following%20feature) gives you a better idea of how to use the Scripting function.

---

<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:** [December 19, 2023, 4:40pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/16 "2023-12-19T16:40:18Z")

</div>

Right, I linked the Action doc above. But it didn't have any indication/link to the corresponding component method. Nor does the component method doc link to the action. 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![HelloWorld](https://avatars.discourse-cdn.com/v4/letter/h/b782af/32.png) [@HelloWorld](https://forum.inductiveautomation.com/u/HelloWorld)\
**Post date:** [December 19, 2023, 4:40pm UTC](https://forum.inductiveautomation.com/t/button-print-different-component/83310/17 "2023-12-19T16:40:42Z")

</div>

Right ! Thanks @cmallonee
