in reply to How to edit a PCL file

What is generating this PCL? A cleaner approach may be to edit the source file either by the use of a module or automating the source application.

Replies are listed 'Best First'.
Re^2: How to edit a PCL file
by GoForIt (Novice) on Apr 01, 2010 at 13:43 UTC
    Hi,

    Thanks for responding. I've searched for CPAN modules but there isn't any that will edit the PCL files. There's one PCL::Simple to create a PCL file. So, I'm out of option there.

    The header of one such file says this: ESC%-12345X@PJL COMMENT HP LaserJet 4100 Series PCL

    I read somewhere that most of the PCL files begin with this statement but again some files miss this information. I've referred to PCL command reference document to understand the characters in the file. But it appears too tedious to follow the entire PCL file.

    Could you tell me what you mean by automating the source application?

    Thanks,
    Thilak

      I was trying to understand where these PCL files are coming from, and what you want to change.

      Say you were using an application, for example Microsoft Word to create documents and save them as PCL files (you can setup a 'dummy' printer driver to output a pcl file to a certain directory. In such a scenario I'd prefer to make the changes you need in the source word document by automating it via Win32::OLE. This solution is easier to maintain, PCL has various version (1-6), PCL files aren't as easy to edit as a text/Word/PDF file.

        These are electronic documents created by the HP printer because the documents mentions the X and Y co-ordinates for cursor position before the actual data that needs to be printed on page. The files I've is PCL version 5.

        Again, %-12345X@PJL ENTER LANGUAGE = PCL, this means that this is a version 5 PCL file.

      I've referred to PCL command reference document to understand the characters in the file. But it appears too tedious to follow the entire PCL file.

      I don't think there really are any other options.  As PCL consists of escape sequences (of varying length) intermixed with graphics (pixel) data and maybe plain text, you won't have much luck finding a "record" separator.  In other words, to really know what is what in the file, you'd have to parse or "understand" each escape sequence...

      What exactly do you need to edit?  (and why, me wonders...)

        These PCL files have some email address fields that needs to be edited so that the document could be electronically sent to the end user where he could get the document printed.