CAPS Universe documentation  1.0.4
All you need to know to be successful
Samsung SPL2 Laser Printer Driver Development

Technical Findings

Printer's Status

The BUSY status bit is curious. Don't know, if the Linux driver does this mistake or the printer itself. From the USB Printer Class Standard point of view, the BUSY bit from the line printer age isn't supported by USB printer's anymore. So, it seems the BUSY bit is emulated by the Linux driver and reports anyoing values.

After switching on the printer (with paper loaded):

0x98 1001 1000
          ^___ NO ERROR
        ^_____ SELECT
       ^______ Paper Not Empty
     ^________ BUSY

Removing the paper from the tray:

0xB0 1011 0000
          ^___ ERROR
        ^_____ SELECT
       ^______ Paper Empty
     ^________ BUSY

Inserting the paper into the tray again:

0x18 0001 1000
          ^___ NO ERROR
        ^_____ SELECT
       ^______ Paper Not Empty
     ^________ NOT BUSY

Result: The ERROR and the PAPER status bits are reliable, the BUSY bit isn't.

Genuine Driver

The genuine driver for the ML1640 from Samsung always creates 4960 dots per line at 600 DPI. Indepently from the real medium size: it prints with 4960 dots to a letter medium and A4 medium and thus, covers a range of 210 mm width. This might be a limit of the printer's firmware or the used OPC drum.

With the margins defined in their corresponding PPD, this results into a print width of:

  • 207,1 mm for a Letter medium
  • 201,0 mm for an A4 medium

INI settings related to these findings

Resolution

Section Variable
features resolution3
features resolution6
features resolution12

Boolean variables to enable a specific print resolution. Not all printers supports all resolutions.

OPC dot width

Section Variable
features dotcount3
features dotcount6
features dotcount12

The OPC (Organic Photo Conductor) supports a specific count of dots at various resolutions. It defines the print width, the driver must always create data for.

Values of these variables are dot counts at a specific resolution. E.g. dotcount6 defines the OPC dot count at 600 DPI and is for the ML-1640 monochrome printer 4960 dots for example.

Mechanical Restrictions

The following information reflect my findings while playing with my ML-1640 printer.

Findings at 600 DPI:

Insert a letter medium into the printer. Print margins left and right are set to zero. Printer driver sends 4960 dots in a line with SPL_LETTER_TYPE.

Result: The first dot is visible at an offset of 6 mm from the left edge.

Insert an A4 medium into the printer. Print margins left and right are set to zero. Printer driver sends 4960 dots in a line with SPL_DINA4_TYPE.

Result: The first dot is visible at an offset of 6 mm from the left edge.

Insert an A4 medium into the printer. Print margins left and right are set to zero. Printer driver sends 4960 dots in a line with SPL_LETTER_TYPE.

Result: The first dot is visible at an offset of 3 mm from the left edge.

Note
This means the value of page_header_record::ptype defines the start position of dot 1 on the OPC. But it seems it does not define the opposite position. Thus, it is always possible to print to the right edge of the medium.

To print the complete width of an A4 medium: Expand the medium guards to the full letter width. Insert an A4 medium and align it to the right guard (e.g. 3 mm away from the center). Now send 4960 dots in a line with SPL_LETTER_TYPE.

Result: This will cover exactly 210 mm and matches the full width of the loaded A4 medium.

Letter

The medium guards are always centric. E.g. the medium - independently of its size - is centered. But the OPC drum seems a litte bit moved to the right, e.g. it has an offset at the left of 6 mm for Letter medium: the print of the first dot of each line starts 6 mm away from the medium's left edge.

Letter mechanics

Thus, for a Letter medium the left margin must be 6 mm or about 17 points, while the right margin can be zero!

Note
The position of the first dot in a line on the medium depends on the value in page_header_record::ptype as well. The mentioned 6 mm offset is valid if the value SPL_LETTER_TYPE is in page_header_record::ptype.

A4

Due to the medium guard mechanics, for an A4 medium this offset is still 6 mm (read the note below).

A4 mechanics

Thus, for an A4 medium the left margin must be 6 mm or about 17 points, while the right margin can be zero!

Note
The position of the first dot in a line on the medium depends on the value in page_header_record::ptype as well. The mentioned 6 mm offset is valid if the value SPL_DINA4_TYPE is in page_header_record::ptype. There is an of 3 mm if page_header_record::ptype is set to SPL_LETTER_TYPE instead.

As a result, since libcapsdriver creates lines which cover the full width of the medium, the first dot sent to the printer must be 6 mm away from the first dot of the line. For a Letter format at 600 DPI the line lenght is 5100 dots and the first dot for the printer is the 142th dot in such a line.

For A4 format the first dot sent to the printer must be 6 mm away from the first dot of the line. At 600 DPI the line length is 4750 dots in this case and the first dot for the printer is the 142th dot in such a line.

Todo:
Does it make a difference regarding printing, if the printer gets a PJL command of the form SET PAPERTYPE=OFF instead of a corresponding format name?