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

Counting Pages in PCL 6

Status
Not open for further replies.

passi

Programmer
Sep 17, 2002
2
DE
Hello everybody,

we want to count the pages in a PCL 6 or PCL XL file, respectively. PCL 5 or below is based on ASCII text, so parsing for some commands which indicate a page switch is no problem. PCL 6 is a binary stream where the size of the commands and parameters is not fixed. How to parse this?

Does anybody know where I can find some information and some examples about PCL 6 and rules for building the binary steams?

Thanx a lot

Pascal Jost

University of Stuttgart
Germany
 
From my limited knowledge of PCL6, I would say that
you have a formidable task in front of you. The
EndPage command in binary is simply 0x44, but as that
is the letter "D" it doesn't get you very far.

I would suggest that you contact HP in Europe and
see if you can get the PCL6 details.

Jim Asman
 
Hi jlasman,

thank you very much for your help.

I already have the technical reference of PCL 6 from HP, but as you said the codes for the commands are readable letters. What's before a command (compareable to ESC) and what's behind a command depends on several things.

Well, what can help a lot is an example for building a command sequence. This will make it much easier for me to understand the documentation. Does anybody has such an example?

Thanx a lot.

Pascal
 
What I have seen is very similar to an Editor/Assembler
for machine code.

The PCL6 code is written in its assembler language
and is then "assembled" into PCL6 object code.

There is a program called "jetasm" that I believe
can also disassemble the obect code. If you could
disassemble and then count the EndPages you might
have it.

Again, contact HP.

Jim Asman
 
Hi Pascal

Did you find a solution to you problem on how to count the pages in a PCLXL file?

Regards
Pieter
 
As Jim states, you'll need to parse the stream using the JetASM dissassembler, or similar.

I wrote one some time ago; an extract from the output (if it will fit in the width here) shows the format (use this in conjunction with your PCL6 Technical Reference document); sorry if it's a bit long ( I don't know the rules/conventions for code snippets/samples in these forums):

[tt]
*** PCL Analysis ***

Date/Time: 2003/03/19 23:24:09
File: F:\aaa\Sample_prn\PCLXL\HP9000_PCL6_abcde.pxl
Size: 788 bytes

Offset(dec) Type Sequence Data / Interpretation
¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
0000000000 Special <Esc>%-12345X Universal Exit Language (UEL)
Comment Switch language to PJL
0000000009 PJL Command @PJL JOB NAME=&quot;Document&quot;[0d][0a]
0000000035 PJL Command @PJL COMMENT &quot;Context data is not available&quot;[0d][0a]
0000000081 PJL Command @PJL COMMENT &quot;Username: &quot;[0d][0a]
0000000108 PJL Command @PJL SET RET=ON[0d][0a]
0000000125 PJL Command @PJL SET DUPLEX=ON[0d][0a]
0000000145 PJL Command @PJL SET BINDING=LONGEDGE[0d][0a]
0000000172 PJL Command @PJL SET ECONOMODE=OFF[0d][0a]
0000000196 PJL Command @PJL SET OUTBIN=UPPER[0d][0a]
0000000219 PJL Command @PJL SET FINISH=NONE[0d][0a]
0000000241 PJL Command @PJL SET PAGEPROTECT=AUTO[0d][0a]
0000000268 PJL Command @PJL SET PAPER=A4[0d][0a]
0000000287 PJL Command @PJL SET HOLD=OFF[0d][0a]
0000000306 PJL Command @PJL SET RESOLUTION=600[0d][0a]
0000000331 PJL Command @PJL SET BITSPERPIXEL=2[0d][0a]
0000000356 PJL Command @PJL SET EDGETOEDGE=NO[0d][0a]
0000000380 PJL Command @PJL ENTER LANGUAGE=PCLXL[0d][0a]
Comment Switch language to PCLXL (PCL6)
0000000407 PCLXL Stream Header 0x292048.. &quot;) HP-PCL XL;2;0;Comment Copyright Hewlett-Pa&quot;
0000000451 0x636b61.. &quot;ckard Company 1989-2000. Version 4.2.1.8[0a]&quot;
0000000492 PCLXL Data Type 0xd1 uint16_xy
0000000493 Value 0x58025802 600 600
0000000497 PCLXL Attribute 0xf889 UnitsPerMeasure
0000000499 PCLXL Data Type 0xc0 ubyte
0000000500 Value 0x00 eInch
0000000501 PCLXL Attribute 0xf886 Measure
0000000503 PCLXL Data Type 0xc0 ubyte
0000000504 Value 0x03 eBackChAndErrPage
0000000505 PCLXL Attribute 0xf88f ErrorReport
0000000507 PCLXL Operator 0x41 BeginSession
0000000508 PCLXL Data Type 0xc0 ubyte
0000000509 Value 0x00 eDefaultDataSource
0000000510 PCLXL Attribute 0xf888 SourceType
0000000512 PCLXL Data Type 0xc0 ubyte
0000000513 Value 0x01 eBinaryLowByteFirst
0000000514 PCLXL Attribute 0xf882 DataOrg
0000000516 PCLXL Operator 0x48 OpenDataSource
0000000517 PCLXL Data Type 0xc2 uint32
0000000518 Value 0x09207068 1752178697
0000000522 PCLXL Attribute 0xf891 **** Reserved ****
0000000524 PCLXL Operator 0x46 **** Reserved ****
0000000525 PCLXL Data Type 0xc0 ubyte
0000000526 Value 0x00 ePortraitOrientation
0000000527 PCLXL Attribute 0xf828 Orientation
0000000529 PCLXL Data Type 0xc0 ubyte
0000000530 Value 0x01 eAutoSelect
0000000531 PCLXL Attribute 0xf826 MediaSource
0000000533 PCLXL Data Type 0xc8c10200 ubyte_array
0000000537 Value 0x4134 &quot;A4&quot;
0000000539 PCLXL Attribute 0xf825 MediaSize
0000000541 PCLXL Operator 0x43 BeginPage
0000000542 PCLXL Data Type 0xc0 ubyte
0000000543 Value 0x00 eNonZeroWinding
0000000544 PCLXL Attribute 0xf854 ClipMode
0000000546 PCLXL Operator 0x7f SetClipMode
0000000547 PCLXL Operator 0x74 SetPageDefaultCTM
0000000548 PCLXL Data Type 0xd3 sint16_xy
0000000549 Value 0x64006400 100 100
0000000553 PCLXL Attribute 0xf82a PageOrigin
0000000555 PCLXL Operator 0x75 SetPageOrigin
0000000556 PCLXL Data Type 0xc3 sint16
0000000557 Value 0x0000 0
0000000559 PCLXL Attribute 0xf829 PageAngle
0000000561 PCLXL Operator 0x76 SetPageRotation
0000000562 PCLXL Data Type 0xd5 real32_xy
0000000563 Value 0x000080.. 1.000000 1.000000
0000000571 PCLXL Attribute 0xf82b PageScale
0000000573 PCLXL Operator 0x77 SetPageScale
0000000574 PCLXL Operator 0x69 SetClipToPage
0000000575 PCLXL Data Type 0xc0 ubyte
0000000576 Value 0x01 eGray
0000000577 PCLXL Attribute 0xf803 ColorSpace
0000000579 PCLXL Operator 0x6a SetColorSpace
0000000580 PCLXL Data Type 0xc0 ubyte
0000000581 Value 0xff 255
0000000582 PCLXL Attribute 0xf809 GrayLevel
0000000584 PCLXL Operator 0x63 SetBrushSource
0000000585 PCLXL Data Type 0xc0 ubyte
0000000586 Value 0x00 0
0000000587 PCLXL Attribute 0xf805 NullPen
0000000589 PCLXL Operator 0x79 SetPenSource
0000000590 PCLXL Data Type 0xc0 ubyte
0000000591 Value 0x00 eOpaque
0000000592 PCLXL Attribute 0xf82d TxMode
0000000594 PCLXL Operator 0x78 SetPatternTxMode
0000000595 PCLXL Data Type 0xc0 ubyte
0000000596 Value 0x00 eOpaque
0000000597 PCLXL Attribute 0xf82d TxMode
0000000599 PCLXL Operator 0x7c SetSourceTxMode
0000000600 PCLXL Data Type 0xc0 ubyte
0000000601 Value 0xf0 e_P
0000000602 PCLXL Attribute 0xf82c ROP3
0000000604 PCLXL Operator 0x7b SetROP
0000000605 PCLXL Operator 0x85 NewPath
0000000606 PCLXL Data Type 0xe3 sint16_box
0000000607 Value 0x880088.. 136 136 4760 230
0000000615 PCLXL Attribute 0xf842 BoundingBox
0000000617 PCLXL Operator 0xa1 RectanglePath
0000000618 PCLXL Operator 0x86 PaintPath
0000000619 PCLXL Data Type 0xc0 ubyte
0000000620 Value 0x01 eGray
0000000621 PCLXL Attribute 0xf803 ColorSpace
0000000623 PCLXL Operator 0x6a SetColorSpace
0000000624 PCLXL Data Type 0xc0 ubyte
0000000625 Value 0x00 0
0000000626 PCLXL Attribute 0xf809 GrayLevel
0000000628 PCLXL Operator 0x63 SetBrushSource
0000000629 PCLXL Data Type 0xc0 ubyte
0000000630 Value 0x01 eTransparent
0000000631 PCLXL Attribute 0xf82d TxMode
0000000633 PCLXL Operator 0x78 SetPatternTxMode
0000000634 PCLXL Data Type 0xc0 ubyte
0000000635 Value 0x01 eTransparent
0000000636 PCLXL Attribute 0xf82d TxMode
0000000638 PCLXL Operator 0x7c SetSourceTxMode
0000000639 PCLXL Data Type 0xc0 ubyte
0000000640 Value 0xfc e_PSo
0000000641 PCLXL Attribute 0xf82c ROP3
0000000643 PCLXL Operator 0x7b SetROP
0000000644 PCLXL Operator 0x85 NewPath
0000000645 PCLXL Data Type 0xc0 ubyte
0000000646 Value 0x00 eOpaque
0000000647 PCLXL Attribute 0xf82d TxMode
0000000649 PCLXL Operator 0x78 SetPatternTxMode
0000000650 PCLXL Data Type 0xc0 ubyte
0000000651 Value 0x00 eOpaque
0000000652 PCLXL Attribute 0xf82d TxMode
0000000654 PCLXL Operator 0x7c SetSourceTxMode
0000000655 PCLXL Data Type 0xc8c11000 ubyte_array
0000000659 Value 0x54696d.. &quot;TimesNewRmn &quot;
0000000675 PCLXL Attribute 0xf8a8 FontName
0000000677 PCLXL Data Type 0xc5 real32
0000000678 Value 0x0000a642 83.000000
0000000682 PCLXL Attribute 0xf8a6 CharSize
0000000684 PCLXL Data Type 0xc1 uint16
0000000685 Value 0x4e02 590
0000000687 PCLXL Attribute 0xf8aa SymbolSet
0000000689 PCLXL Operator 0x6f SetFont
0000000690 PCLXL Data Type 0xd3 sint16_xy
0000000691 Value 0x8800d200 136 210
0000000695 PCLXL Attribute 0xf84c Point
0000000697 PCLXL Operator 0x6b SetCursor
0000000698 PCLXL Data Type 0xc9c10500 uint16_array
0000000702 Value (U+) 0x610062.. &quot;abcde&quot;
0000000712 PCLXL Attribute 0xf8ab TextData
0000000714 PCLXL Data Type 0xc8c10500 ubyte_array
0000000718 Value 0x252a25.. ( 37 42 37 42 0 )
0000000723 PCLXL Attribute 0xf8af XSpacingData
0000000725 PCLXL Operator 0xa8 Text
0000000726 PCLXL Data Type 0xc0 ubyte
0000000727 Value 0x01 eTransparent
0000000728 PCLXL Attribute 0xf82d TxMode
0000000730 PCLXL Operator 0x78 SetPatternTxMode
0000000731 PCLXL Data Type 0xc0 ubyte
0000000732 Value 0x01 eTransparent
0000000733 PCLXL Attribute 0xf82d TxMode
0000000735 PCLXL Operator 0x7c SetSourceTxMode
0000000736 PCLXL Data Type 0xc1 uint16
0000000737 Value 0x0100 1
0000000739 PCLXL Attribute 0xf831 PageCopies
0000000741 PCLXL Operator 0x44 EndPage
0000000742 PCLXL Operator 0x49 CloseDataSource
0000000743 PCLXL Operator 0x42 EndSession
0000000744 Special <Esc>%-12345X Universal Exit Language (UEL)
Comment Switch language to PJL
0000000753 PJL Command @PJL EOJ NAME=&quot;Document&quot;[0d][0a]
0000000779 Special <Esc>%-12345X Universal Exit Language (UEL)

*** End of analysis ***
[/tt]

(Jim: 'Dan' is not old enough to be interested in tech. topcs yet).
 
Our PCLTool Program or PCLTool SDK can count PCL XL pages.

We provide the page count in the .log file generated when you try to view or convert a PCL XL file. We currently do not view or convert PCL XL, just PCL3-5e. Our next release adds PCL5c. And, we have a beta PCL XL text extraction tool, then also counts pages.

Bob Pooley
PageTech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top