Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Locate Beginning Of Page in PCL4/5 File

Status
Not open for further replies.

mr13stu

Technical User
Feb 7, 2003
1
US
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,
mr13stu
 
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
jlasman@telus.net
 
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

 
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
UEL
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.
 
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.

Regards,
Bob Pooley
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top