How to create new PCL file similar to existing MS doc. I have Ms doc tamplate and replacing it with actual data. I need to achieve same for PCL format (Create PCL file as tamplate and replacing it with actual value from database and send it to fax).
- install a new printer
- when asked for a port, create a new port of type "Local Port"
- as name of the port, enter some file name, e.g.
c:\temp\print.pcl
- select some PCL-compatible printer, e.g. HP LaserJet 4, or whatever your fax is comptaible with
When you print to this printer, Windows will write the output to that file.
Many programs allow you to redirect printing to a file; in this case, you'd be able to select a different file name for each print job.
If you are trying to generate an actual template (PCL Macro) to merge with data, you will need to generate the PCL output using a PCL driver and convert that to a PCL Macro.
A typical situation is that you have an overlay that is downloaded to the printer and data from a host system (Unix, AS/400 etc.) sends the data is superimposed over the overlay. We do this a lot for customers who are migrating from a host application, dot matrix printer, pre-printed forms --> the same host application, laser printer, blank paper.
Generate you output using print to file using a standard PCL driver (the HP LaserJet 5 and 4000 are the ones I've had the most success 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 certain elements such as formfeed etc. basically any kind of command that would cause a page eject. It also contains codes that define it as a Macro and give it an ID.
aOnce created you can send down your standard text with an escape sequence to trigger the form.
&f#y3X where # is the Macro ID (could also be &f#y2X, &f#y4X depending on your needs)
You can convert these files yourself if you have PCL experience; however, I recommend you stick with some of the tools that are out there. Some of these include:
- Lexmark Custom Printer Driver (I tend to use the T616, you will find the option you need under the User Customize tab)
- HP Forms & Font Manager
- PCLWorks (views PCL, also converts image formats to PCL Macros)
The other trick is sometimes adding in the trigger code. This isn't an issue if you have control over the host application and it allows for the insertion of control codes. If however, you don't you can use a shell script in Unix, workstation customizing object in OS/400, or even use the separator sheet function in a Windows printer queue to insert a the commands (you need to use the @F command).
You might want to check this link. There is an entire section on PCL Macros: HP PCL Reference Guide
Hopefully this is what you are looking for. This can be kind of complex. If you need more information drop a comment in this post and I will add more, detailed, information.
I found the simple solution and it works. convert the .doc file tamplete to PCL using tool (available on net). open it in edit plus and study... i relize i can modify it according to my need. if u check it u wil see each charector is with its position Example: p0Yp796Y*p1582Xn -- means charector n at position (x-axis 1582 and y-axis 796) at screen. so what now i can change anything, add new object, line etc at position acording to my need. I know its tedious but works for me....
You can generate PCL with FOP.
If you can work with the docx format, docx4j can use FOP for output.
(If you must work with .doc, docx4j has rudimentary conversion using poi hwpf)