iFormBuilder Zebra Printing
Table of Contents
- What is a ZPL file?
- What is the iformbuilder.zebra print function?
- How do I print using the iformbuilder.zebra.print function?
Also, check out:
What is a ZPL file?
A ZPL file is the Zebra Programming Language which defines the format in which the printer will print out.
What is the iformbuilder.zebra.print function?
The Zebra Printing functionality allows you to print directly in the form itself, in addition to the current way you can print from the record view. The iformbuilder.zebra.print function allows custom JavaScript and other logic to trigger printing as well as allow for multiple configuration points.
How do I print using the iformbuilder.zebra.print function?
To print using the built-in function, please follow the steps below.
The built-in Zebra function can handle up to 3 parameters:
- Quantity: The number of copies to be printed. (Ex. 2)
- ZPL File: The name of the ZPL file to be printed. (Ex. LABEL.ZPL)
- Images: Pass in any images you would like printed: ["data_column_name,zpl_image_reference,Width,Height"]
- data_column_name: This is the data column name of a Signature, Image or Drawing element in your form.
- zpl_image_reference: This reference is made up of the first 5 characters of your ZPL file name followed by 000. For the first image, this would be LABEL000 and the second image would be LABEL001, etc.
- Width: This is the width of the image (in pixels).
- Height: This is the height of the image (in pixels).
To pass in multiple images the format would be as follows:
["data_column_name1,zpl_image_reference1,Width,Height","data_column_name2,zpl_image_reference2,Width,Height"]
STEP 1. Create a ZPL File and make sure it is loaded on the Zebra printer. In this example our ZPL name is LABEL.ZPL
If you're unsure how to create a ZPL file, please follow these instructions.
STEP 2. Determine where and when in your form you would like to invoke the print function. For this example, we will have a simple form with 3 Text Elements:
- first_name
- company
- title
These data column names must match what is configured in the ZPL file in order for them to print on the screen.
STEP 3. Add a Select Element to your form with a data column name of my_select_button.
STEP 4. Create an Option List with a single option. In this example, the option will be Print. This will appear as a button on your form with the label text of your choosing.
STEP 5. Click Assign Selected to assign the Option List to the Select element.
STEP 6. Since this is a built-in function, we'll need to build the function in the Dynamic Value field of a Text Element.
Add a Text Element, which will be used to execute the built-in function.
STEP 7. Next, we'll write an "if" statement so that when the Select Element we created in Step 3 is clicked, the print function will execute.
In the Dynamic Value field of the Text Element, put the following:
if( my_select_button==0 ){ iformbuilder.zebra.print(1,"LABEL.ZPL") } else{ "" }
STEP 8. In the Condition Value field of the Text Element, put the word false. This hides the element on the device side.
STEP 9. Save your form.
STEP 10. Sync the form to your device.
STEP 11. Be sure the Zebra printer is connected through BlueTooth settings.
STEP 12. Fill out the form and click the Print button you set up to print the record.
Comments
0 comments
Please sign in to leave a comment.