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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Extracting pages...

Status
Not open for further replies.

t8lee

Programmer
May 26, 2003
4
0
0
CA
I would like to be able to extract a page or multiple pages from a pcl file. I plan to send the extracted pages to another PCL file or straight to the printer. What would be the best way to do this? Thanks
 
There is NO magic formula to do this as it will be dependent on how the page was formatted originally.

In the best case scenario from your standpoint, you are dealing with straight text and the application has issued a formfeed for the page break. Then you only need to look for the FF, char(12), in the output. It can get complicated very quickly if raster images or fonts are embedded in the data stream that contain char(12)'s. You will have to do some detective work to look for a "foolproof" means of detecting the page break.

If the output is a basic "print and space" application where the page is defined by the margins defined in the page format code. Typically you might find there are 60 print lines on a letter size sheet. Partial pages are padded with blank lines to fill the page. In this case, you only need to keep a line count to determine the page break.



Jim Asman
jlasman@telus.net
 
If the PCL file is just a text report with no raster
graphics (for example) then you might parse the file
based on CHR$(12) formfeed and extract the page wanted
between the formfeeds.
 
Not all PCL is constructed like it was in the old days (pre-Windows printer drivers). And, custom PCL from applications where there is heavy reliance on the printer's front panel defaults being set a certain way... are very problematic and often require you to "back into" a method of determining page offsets.

However, getting the page offset from the beginning of the file is not going to do you much good with a Windows printer driver generated printstream. This is because Windows downloads temporary bitmap fonts in the order in which they are used and re-uses character cells throughout a print stream. So, if you can get to page 27 and extract all the PCL to the begging of page 28... you then have to "NORMALIZE" it by embedding the temporary font in the state it was in at page 27. There aren't more then 4-5 companies that can do this with any Windows print stream.

Stating the origin and composition of the PCL really helps those who want to provide help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top