If you are trying to generate an actual template (PCL Macro) to combine with data, you will need to generate PCL output using the PCL driver and convert it to a PCL macro.
A typical situation is that you have an overlay loaded on the printer, and data from the host system (Unix, AS / 400, etc.) sends data overlaid on top of the overlay. We do this a lot for customers who are switching from a host application, a dot matrix printer, pre-printed forms → the same host application, a laser printer, and blank paper.
Generate output using print to file using the standard PCL driver (the HP LaserJet 5 and 4000 are the ones I have been most successful with in terms of using these PCL files on other manufacturers devices). After that you will have to convert to a PCL macro. This is a special PCL file that does not contain specific elements, such as formfeed, etc., basically any command that will lead to the exit of the page. It also contains codes that define it as a macro and give it an identifier.
Created
aOnce you can submit your standard text using an escape sequence to invoke the form.
& f # y3X, where # is the macro identifier (it can also be & f # y2X, & f # y4X depending on your needs)
You can convert these files yourself if you have experience with PCL; however, I recommend that you stick with some of the tools that are there. Some of them include:
- Lexmark custom printer driver (I usually use T616, you will find the option you need on the "Customization" tab).
- HP Forms and Font Manager
- PCLWorks (view PCL, also converts image formats to PCL macros)
Another trick is sometimes added to the startup code. This is not a problem if you have control over the host application, and it allows you to enter control codes. If, however, you cannot use the shell script on Unix, the workstation setup object on OS / 400, or even use the separator sheet function in the Windows printer queue to insert commands (you need to use the @F command).
You can check this link. Macros PCL has a whole section: HP PCL Reference Guide
Hope this is what you are looking for. It can be tricky. If you need more information, write a comment in this post and I will add additional, detailed information.