Anyone have code to strip text from HP-PCL5 files? 
Author Message
 Anyone have code to strip text from HP-PCL5 files?

I know there are programs (e.g., pstotext) to strip text from
postscript files, but has anyone got any code to do the same thing for
HP-PCL5 files?

Alternatively, are there any editors or word processors that
understand HP-PCL5, and can present an on-screen image of the text
that the printer would produce, maybe with an option to save-as a
simple text file (i.e., with the PCL5 codes stripped out)?

TIA for any help, info or url's you can provide.

----------------------------------------------------




Mon, 02 Apr 2001 03:00:00 GMT  
 Anyone have code to strip text from HP-PCL5 files?

Quote:
> Alternatively, are there any editors or word processors that
> understand HP-PCL5, and can present an on-screen image of the text
> that the printer would produce, maybe with an option to save-as a
> simple text file (i.e., with the PCL5 codes stripped out)?

  http://www.ndg.com/plug1.htm

________________________________________________________________________

Juergen Kahrs                                       Tel.  0421  249 666
Millstaetter Strasse 15                             Tel.  0421  457 2819
D 28359 Bremen                                      Fax   0421  457 3578
____________ http://home.t-online.de/home/Juergen.Kahrs/ _______________



Mon, 02 Apr 2001 03:00:00 GMT  
 Anyone have code to strip text from HP-PCL5 files?

Quote:
>I know there are programs (e.g., pstotext) to strip text from
>Postscript files, but has anyone got any code to do the same thing for
>HP-PCL5 files?

>Alternatively, are there any editors or word processors that
>understand HP-PCL5, and can present an on-screen image of the text
>that the printer would produce, maybe with an option to save-as a
>simple text file (i.e., with the PCL5 codes stripped out)?

>TIA for any help, info or url's you can provide.

>----------------------------------------------------



I have a very basic awk utility that simply strips almost all HP-PCL escape
sequences from files that otherwise contain plain text. It doesn't translate
positioning sequences, so if your text contains overwriting, tabstops or
other positioning formatting, it'll be garbled. Also, it dies when it
encounters embedded binary data. Without further ado, here it is.

# {*filter*}on binary data, embedded fonts, etc.
/\x1B\&p[0-9]+X/ || /\x1B[()]s[0-9]+W/ || /\x1B\*b[0-9]+W/ {
    print "Encountered binary data block. Unable to procede."
    exit

Quote:
}

{
    gsub("\x1B[9=]", "")            # simple sequences

    print
Quote:
}



Mon, 02 Apr 2001 03:00:00 GMT  
 Anyone have code to strip text from HP-PCL5 files?
<Snipped>

Quote:
>I have a very basic awk utility that simply strips almost all HP-PCL escape
>sequences from files that otherwise contain plain text. It doesn't translate
>positioning sequences, so if your text contains overwriting, tabstops or
>other positioning formatting, it'll be garbled. Also, it dies when it
>encounters embedded binary data. Without further ado, here it is.

># {*filter*}on binary data, embedded fonts, etc.
>/\x1B\&p[0-9]+X/ || /\x1B[()]s[0-9]+W/ || /\x1B\*b[0-9]+W/ {
>    print "Encountered binary data block. Unable to procede."
>    exit
>}
>{
>    gsub("\x1B[9=]", "")            # simple sequences

>    print
>}

Thanks for the code, Harlan.  Unfortunately, I made an incorrect
assumption, and it looks like the files I've got are not PCL5, but
something called PCLXL.  Here are the headers in the file:


) HP-PCL XL;1;1;Comment Copyright Hewlett-Packard Company 1989-1996

Have you or anyone else ever seen this printer language?  I'm not
familiar with it myself.  I wonder if it's an extension of HPGL, the
plotting language?

I can see the text I want to extract when I browse the file, but there
is a *LOT* of binary stuff and what looks like font information in
between chunks of text.

I guess I'll go to one of the HP forums and ask around there.

Thanks again for your code.  It may well come in handy one day!

----------------------------------------------------




Mon, 02 Apr 2001 03:00:00 GMT  
 Anyone have code to strip text from HP-PCL5 files?
<Snipped>

Quote:
>  http://www.ndg.com/plug1.htm

Thanks for the url, Juergen.  I downloaded a trial copy, but their
software doesn't recognize the printer language in the file.  I made
an assumption that it was PCL, but it seems it is really something
called PCLXL.  Here are the headers that start the file:


) HP-PCL XL;1;1;Comment Copyright Hewlett-Packard Company 1989-1996

Have you ever seen this printer language before?  Is it perhaps an
extension of the HPGL plotting language?

As I said to Harlan, who also replied, I guess I'll go ask around one
of the HP forums to try to get some more data about this language.

Thanks again for the url.

----------------------------------------------------




Mon, 02 Apr 2001 03:00:00 GMT  
 Anyone have code to strip text from HP-PCL5 files?

Quote:
> software doesn't recognize the printer language in the file.  I made
> an assumption that it was PCL, but it seems it is really something
> called PCLXL.  Here are the headers that start the file:

In the early 90s I bought the official doc about HP's printer
languages. IIRC, the ensemble of it all is called RTL (Raster
Transmission Language ?). RTL consists of three completely distinct
parts:

  1. PCL, most important, text with escape sequences
  2. PJL, Printer Job language, controls # of copies, dpi etc.
  3. HPGL, the plotting language

Escape sequences are used to switch from any of the three modes
to any other of them. Your example has the usual header with
PJL commands.

This is obviously PJL. But it seems they have changed the way of
switching between modes.

Quote:
> ) HP-PCL XL;1;1;Comment Copyright Hewlett-Packard Company 1989-1996

This is new to me.

Quote:

> Have you ever seen this printer language before?  Is it perhaps an
> extension of the HPGL plotting language?

> As I said to Harlan, who also replied, I guess I'll go ask around one
> of the HP forums to try to get some more data about this language.

I can recommend the official doc by Hewlett Packard. The book has an
ordinary ISBN and costs about $50 in the book stores.
This is excellent doc. As an alternative, look into the manual of your
printer. The manuals contain more useful info than most people can
imagine.

________________________________________________________________________

Juergen Kahrs                                       Tel.  0421  249 666
Millstaetter Strasse 15                             Tel.  0421  457 2819
D 28359 Bremen                                      Fax   0421  457 3578
____________ http://home.t-online.de/home/Juergen.Kahrs/ _______________



Tue, 03 Apr 2001 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. need to print BMP file to HP PCL5 printer via Clipper 5.2

2. Image file (.bmp, .tif, .gif) to PCL5 code

3. anyone have ASCII text file of ABEND codes??

4. Strip characters and lines from a text file

5. Source code to strip line feeds from file

6. Clipper String Strip Code? (Strip PCL codes from file)

7. Anyone have a text editor in Ada Code?

8. HP Legal-Size HP codes

9. Having problems changing printer settings within the program code (anyone having problems w/ OkiData printers?)

10. has anyone got a simple text file selector and viewer

11. REAL Control Strip 1.0 - control strips for REALbasic applications

12. Anyone else having trouble with GIFs?

 

 
Powered by phpBB® Forum Software