# Difficulties configuring print job for Zebra ZD620

**URL:** <https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154>\
**Category:** Ignition\
**Created:** [September 29, 2020, 12:33am UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154 "2020-09-29T00:33:34Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dryhops](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dryhops](https://forum.inductiveautomation.com/u/Dryhops)\
**Post date:** [September 29, 2020, 12:33am UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/1 "2020-09-29T00:33:34Z")

</div>

I’m working on a project that has a few old reports (pallet labels) created prior to the reporting module update in 7.8. These reports print fine on an inkjet printer when you manually right click on the report and choose ‘print’.

Our goal is to remove this manual step, and automatically print these reports on a Zebra ZD620 thermal sticker printer. The reports and the stickers are both 4x6 inches.

I have two separate problems preventing me from accomplishing this.

Problem 1:

I know this is a fairly common use case, but I’m having difficulty properly configuring the print job. I’m attempting to use the following code that’s suggested in other similar posts:

report = event.source.parent.getComponent(“Report Viewer”)  
…#set various options  
report.print();

This prints, but at the component level so there are page numbers and the scaling % dropdown visible on the label. If I manually print via the right click context menu, everything is perfect. Is there any way to create the print job programmatically that behaves similar to the context menu printing? Or is it only possible to print the component via scripting?

Problem 2:

When I attempt to print the label to the Zebra, the orientation is initially wrong. Even setting report.orientation doesn’t change this. However, if I print to the inkjet first, then the Zebra after, everything prints correctly. This leads me to believe that certain inkjet printer settings carry over to the Zebra job. Looking at the page setup tab, it looks like the inkjet printer allows me to select a paper size, while the Zebra does not. Is there a way to determine what settings at being used on the inkjet job that might be absent from the Zebra job?

Inkjet shows paper size:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/7/07f2395f340be2f1259616fd3d1000ceaf6c9a3e.png)  
Zebra does not:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/2/f2487358b1ab217f52da8b16603cab44df0c4e57.png)

If I cannot find a solution, My plan B is to recreate the label in ZPL, but since the label actually does print correctly under certain circumstances, I’d rather not reinvent the wheel.

Thanks for your time.

---

<div class="post-metadata">

**Author:** ![Paullys50](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paullys50/32/3324_2.png) [@Paullys50](https://forum.inductiveautomation.com/u/Paullys50)\
**Post date:** [September 29, 2020, 10:08am UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/2 "2020-09-29T10:08:28Z")

</div>

I recommend going the ZPL route. I've done it with the reporting module and it's never been ideal. You'll have more control and flexibility by generating the ZPL at the script level and bypassing the report module all together.

> [@Print Label w/o User Print Dialog](http://forum.inductiveautomation.com/t/print-label-w-o-user-print-dialog/29605/2):
>
> Looks like you can use ZPL with that printer, my suggestion would be to generate a ZPL string instead. Head over to [Labelary Online ZPL Viewer](http://labelary.com/viewer.html) and you can see an example. See this post as using system.net.httpPost to send it to the printer. The printer may or may not accept a print with this command, Zerbra branded printers work great, but I’ve have printers that emulate ZPL not work with this script, but I was able to use the TCP/UDP driver to connect and send the ZPL through that instead.

---

<div class="post-metadata">

**Author:** ![Paullys50](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paullys50/32/3324_2.png) [@Paullys50](https://forum.inductiveautomation.com/u/Paullys50)\
**Post date:** [September 29, 2020, 10:16am UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/3 "2020-09-29T10:16:07Z")

</div>

I should add, I went through all of this with IA support over 1 year ago. Tried to use system.report.executeAndDistribute() and never printed correctly where as using the .print() function it would. Then had issues with print drivers on the Ignition gateway and overall was a mess trying to go with the reporting module.

---

<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:** [September 29, 2020, 1:06pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/4 "2020-09-29T13:06:44Z")

</div>

I endorse converting to ZPL, and using a raw TCP socket to deliver the job. Been there, done that, happy customer.

---

<div class="post-metadata">

**Author:** ![Dryhops](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@Dryhops](https://forum.inductiveautomation.com/u/Dryhops)\
**Post date:** [September 29, 2020, 2:22pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/5 "2020-09-29T14:22:10Z")

</div>

Thanks for the help. I decided to take your guy’s advice and try the ZPL solution. I came up with a working example this morning using Zebra’s Zdesigner software. Currently I’m just finding/replacing string tokens to generate variable labels. Is there any benefit to saving the template on the printer itself and passing parameters? Or do you guys just do it with string operations?

---

<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:** [September 29, 2020, 2:23pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/6 "2020-09-29T14:23:52Z")

</div>

I do all the templating in Ignition.

---

<div class="post-metadata">

**Author:** ![ryanjmclaughlin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryanjmclaughlin/32/4318_2.png) [@ryanjmclaughlin](https://forum.inductiveautomation.com/u/ryanjmclaughlin)\
**Post date:** [October 17, 2020, 4:01pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/7 "2020-10-17T16:01:13Z")

</div>

While Zebra has a ton of options for templating, I rarely find people using it. If the printer is ever swapped or changed, how do you ensure the template is on the new printer. Easier just to keep everything in Ignition and only worry about what IP address to send the ZPL data to.

---

<div class="post-metadata">

**Author:** ![yifeiliu08](https://avatars.discourse-cdn.com/v4/letter/y/bbe5ce/32.png) [@yifeiliu08](https://forum.inductiveautomation.com/u/yifeiliu08)\
**Post date:** [October 17, 2020, 11:52pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/8 "2020-10-17T23:52:24Z")

</div>

I have the same problem with you before, I install the driver on the PC

1. you should setPrintName
2. if you want it directly print without popup a window, you should setPrintDialog =0
3. you should change the parameter of set Orientation
4. you should set the ZoomFactor  
the last but not least, the most import thing is the following two parameter  
PageHeight and PageWidth,that you should manual change it’s parameter to see what happen  
I have the experience the same parameter (Height and Width), different print will have different result

after you set the correct information , then you can use a button to trigger or make it working in a client scripting trigger by some tags

```auto
	job = system.print.createPrintJob(ui.parent.getComponent('print'))
	#job = system.print.createPrintJob(event.source.parent)		
	#job.setPrinterName('Cumtenn CTP-2200 Series')	
	job.setPrinterName('FX DocuPrint P378 db')	
	job.setShowPrintDialog(0)
	job.setPageHeight(12)
	job.setPageWidth(10)
	
	job.setBottomMargin(0.01)
	job.setTopMargin(0.01)
	job.setRightMargin(0.01)
	job.setLeftMargin(0.01)
	job.setOrientation(0)
	job.setZoomFactor(0.62)
	job.print()	

```

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [May 23, 2022, 7:29pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/9 "2022-05-23T19:29:03Z")

</div>

May I ask how you do the templating in Ignition and get the ZPL code from that?

---

<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:** [May 23, 2022, 7:57pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/10 "2022-05-23T19:57:12Z")

</div>

The one customer of mine that does this is still on v7.9, so modern `.format()` is not available. The next best thing is string interpolation given a dictionary. In that application, the ZPL template itself is pulled from a product database. So the code looks something like this:

```auto
pyds = system.db.runPrepQuery("""SELECT item.*, product.*
    FROM item INNER JOIN product ON .....
    WHERE item.id = ?""", [item_id], 'datasource')
ds = pyds.underlyingDataset
cHeads = ds.columnNames
if ds.rowCount != 1:
    raise ValueError("Unexpected dataset error")
tplParams = {}
for c, name in enumerate(cHeads):
    # Ignore values from duplicate columns
    tplParams.setdefault(name, ds.getValueAt(0, c))
zpl = tplParams['template'] % tplParams
sock = socket.socket()
try:
    sock = socket.connect(('someAddress', 6101))
    sock.sendall(zpl)
finally:
    sock.close()

```

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [May 23, 2022, 8:01pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/11 "2022-05-23T20:01:45Z")

</div>

Oh, ok. So you create the actual ZPL template outside of Ignition and store in a database table. You don’t actually create the ZPL template in Ignition somehow?

---

<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:** [May 23, 2022, 8:03pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/12 "2022-05-23T20:03:18Z")

</div>

No. Customer supplied. Tweaked by me to have proper `%(columnName)...` substitutions where needed.

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [May 23, 2022, 8:05pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/13 "2022-05-23T20:05:59Z")

</div>

Gotcha.

I was dreaming of being able to design a label in the report designer or a window and generating ZPL from that, like print to file. Pipedream…

---

<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:** [May 23, 2022, 8:07pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/14 "2022-05-23T20:07:14Z")

</div>

In a past life I used an older version of [Bartender](https://www.seagullscientific.com/) that I think allowed WYSIWYG editing → ZPL export.

---

<div class="post-metadata">

**Author:** ![Duffanator](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/duffanator/32/3560_2.png) [@Duffanator](https://forum.inductiveautomation.com/u/Duffanator)\
**Post date:** [May 23, 2022, 8:36pm UTC](https://forum.inductiveautomation.com/t/difficulties-configuring-print-job-for-zebra-zd620/39154/15 "2022-05-23T20:36:45Z")

</div>

Cool,

I found [this](https://www.zebra.com/us/en/support-downloads/printer-software/zebra-designer-3-developer.html) on Zebra’s website (developer designer) that is free and seems nice so far. Thanks for the info!
