Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Locate Beginning Of Page in PCL4/5 File

Locate Beginning Of Page in PCL4/5 File

Locate Beginning Of Page in PCL4/5 File

I am trying to locate the beginning of each page in some large PCL files that are coming back from a document vendor.  I need to add a unique system identifier.  I know how to insert the text, but am having trouble reliably finding the beginning of each page.  I would appreciate any help.

Thanks in advance,

RE: Locate Beginning Of Page in PCL4/5 File

It depends on how the document is being paged. This can be different from document to document.

You are probably either going find that the file is relying upon the printer setup to do a page eject after 60 lines or what have you. Otherwise, the document probably contains an explicit FORMFEED at the end of each page. The FF would be seen as a ^L in a text editor or 0x0C when looking at a hex dump.

If there are any bitmap images in the file, they quite likely would contain ^L's as part of their binary data, so study the page breaks and look for a pattern on known page endings.

Jim Asman

RE: Locate Beginning Of Page in PCL4/5 File

If you mean the topmost starting place that the "vendor"
starts his document and the document is purely pcl then
you might look for Esc&a

Once found check for #r or #R (but then you will also need
the current LPI more about that later)

Or for #v (@V)

Or for ESC*p#y (#Y)

#R is row numbwe (the LPI currently used will alter the absolute position)

#V is number of 720ths of an inch (without regard to margin)
#Y is the number of dots 1=1/300 "

Now be aware that + - can be used before any of these meaning + or - relative to the current position rather
than absolute positioning.

ESC of course means ascii 27 Escape

RE: Locate Beginning Of Page in PCL4/5 File

You should also look for commands that cause a 'conditional page break'.  These cause a page break if there is any printable data in the buffer at the time that they are given.  The commands are: Paper size
                          Page Length
                          Page Orientation
                          Print current page
                          Simplex/Duplex Binding
                          Paper source
                          Text Length
                          Reset Printer
                          Flush all pages
                          Paper Source

You can check any PCL manual to find the escape sequences.  If you don't see any form feed commands, then look for one of these.  Hope this helps.

RE: Locate Beginning Of Page in PCL4/5 File

If you're lucky, you'll have a PCL file were all the resources for each page are on each page (which defeats the purpose of PCL used for in high volume print streams).

Finding the offset from the beginning of the PCL print stream for every page is the easy part.  Once you get to the offset, you also need to "normalize" the extracted page with all the environment variables, temp. download bitmap font character cell assignments, macros, etc... so, that you can re-print or interpret the PCL for rendering to the screen, file or to a non-PCL printer.

If you're hell-bent on doing it without third party tools that specialize in this area, then at least get PCLTool Program (Pilot Version) to assist you in the disassembly of your PCL using the PCLCodes program that is included.

Bob Pooley

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close