printer requests wrong paper size for custom page size document

Questions on certain printers and applications
Post Reply
jhuber
Posts: 3
Joined: Mon Apr 04, 2022 2:37 pm

printer requests wrong paper size for custom page size document

Post by jhuber »

I am running Ubuntu 20.04 with the latest TurboPrint. I am controlling a Xerox VersaLink C7030 using the TurboPrint HP ColorLaserJet PCL6XL driver. The C7030 supports PCL6/5e and PDF.

In TurboPrint, I have set up a custom paper size 8.19 x 8.5 inches using the Sizes button in the TurboPrint Control Center. This is a form to be filled in by printed text. When I print using this page size, the printer requests a paper size of 9.0 x 8.69 in the manual feed tray; the paper dimensions are increased by a factor of about 1.06. I can get the printer to request 8.19 x 8.5 paper by shrinking the custom paper size in the TurboPrint Control Center, but then the printed material is truncated because the apps think that the document size is larger than the paper it will be printed on. This happens with multiple applications.

I have looked at the print file in /vars/spool/cups. The print data file appears to be a PDF that I can open with a PDF reader. The spool file looks fine in the PDF reader, and the PDF reader reports that the page size is 8.19 x 8.5, which is correct. Is TurboPrint just sending this raw file to the printer, or is it also sending some additional control information to the printer that sets up the page size? I have also looked through the TurboPrint logs. There are various different dimension types used, but in all cases they seem to convert to the correct 8.19 x 8.5 paper size.

I'm trying to figure out why the printer is requesting a page size that is 1.06 times larger that the actual paper size. I don't have any trouble in Windows printing to the 8.19 x 8.5 paper size using the Xerox PCL6 driver. It could be a bug in printer firmware, or a bug in TurboPrint.

Any thoughts on what might be happening?

Thanks!
jhuber
Posts: 3
Joined: Mon Apr 04, 2022 2:37 pm

Re: printer requests wrong paper size for custom page size document

Post by jhuber »

After some more investigation, I believe I have found the problem. I used tcpdump to capture the stream being sent to the printer, and extracted the stream with WireShark. PCL 6/XL is compiled, and not human readable, so I used a program called EscapeE to decompile the PCL XL code sent to the printer. The problem code snippet is

Code: Select all

 ubyte 2=  2 CustomMediaSizeUnits
 uint16_xy 2207, 2286  CustomMediaSize
From the HP PCL XL Feature Reference Protocol Class 2.0, CustomMediaSizeUnits = 2 is eTenthsOfAMillimeter. There are 254 tenth-mm/inch. As such, 2208 mm / 254 = 8.69 inches, and 2286 mm / 254 = 9.0 inches. It seems that the driver is calculating the page size wrong and sending the wrong data to the printer.

The complete job code (except for the data printed on the page) is shown below.

Code: Select all

{Reset}
{Enter PJL}
@PJL JOB{LF}
@PJL SET JOBNAME = "GnuCash-Checks"{LF}
@PJL SET USERNAME = "jhuber"{LF}
@PJL SET COPIES=1{LF}
@PJL SET RENDERMODE=COLOR{LF}
@PJL SET RESOLUTION=600{LF}
@PJL SET BITSPERPIXEL=8{LF}
@PJL ENTER LANGUAGE = PCLXL
 ubyte 0=  Inch Measure
 ubyte 0=  NoReporting ErrorReport
 uint16_xy 1200, 1200  UnitsPerMeasure
BeginSession
 ubyte 0=  Default SourceType
 ubyte 1=  LowByteFirst DataOrg
 ubyte 0=  Portrait Orientation
 ubyte 2=  2 CustomMediaSizeUnits
 uint16_xy 2207, 2286  CustomMediaSize
 ubyte 2=  ManualFeed MediaSource
 ubyte 0=  0 Unknown attribute 36
array[5] 80, 108, 97, 105, 110=Plain  MediaType
 ubyte 0=  SimplexFront SimplexPageMode
BeginPage
 uint16_xy 200, 200  Point
SetCursor
 ubyte 2=  RGB ColorSpace
SetColorSpace
 ubyte 0=  NoTreatment ColorTreatment
SetColorTreatment
 ubyte 1=  1 AllObjectTypes
 1 Unknown attribute 192
 IndexedPixel ColorMapping
 ubyte 2=  8Bit ColorDepth
 uint16 4713  SourceWidth
 uint16 4899  SourceHeight
 uint16_xy 9426, 9798  DestinationSize
BeginImage
 uint16 0  0 StartLine
 uint16 4899  BlockHeight
 ubyte 3=  DeltaRow CompressMode
 ubyte 1=  1 PadBytesMultiple
ReadImage
Data [121809] 35, 62, 224, 255, 255, etc.=#> [deleted to save space] EndImage
EndPage
EndSession
{LF}
{Enter PJL}
@PJL EOJ{LF}
{Enter PJL}
zedonet
Site Admin
Posts: 2156
Joined: Fri Oct 06, 2006 8:02 am

Re: printer requests wrong paper size for custom page size document

Post by zedonet »

Hello and thank you for finding this error. I just fixed this and will send you a corrected TurboPrint component by email. The fix will be included in the next TurboPrint release.
Post Reply