Go to the first, previous, next, last section, table of contents.

Pages and Paging

Fax Page Sizes

QFAX v2.x supports all the ITU-TSS combinations of page sizes and widths in text2g3, qfax, qfv and printfax.

Page Widths

Key     Pixels      mm      Descriptive

0       1728        215     A4 (note 1)
1       2048        255     B4 (note 1)
2       2432        303

Page Lengths

Key     Pixels      mm      Descriptive

0       2286        297     A4 (note 1)
1       2804        364     B4 (note 1)
2                           Unlimited (note 2)

Table 1.0 ITU-TSS G3 page sizes

  1. Well almost !
  2. text2g3 imposes an arbitrary limit of 16.7 million pixel lines per page

The guaranteed printable area defined by the ITU-TSS is less than these limits, text2g3 will automatically page files at the following pixel sizes, unless the length is set to unlimited, or you page manually.

Size    Pixels
  A4    2240
  B4    2760

QFAX_DAT keywords for paging

WIDTH_S
Defines the default page width that text2g3 uses when encoding fax. The values are a numeric key as in table 1. The default is A4 width.

WIDTH_S = 0

PAGE_S
Defines the default page length that text2g3 uses when encoding fax. The values are a numeric key as in table 1. The default is A4 page length.

PAGE_S = 0

WIDTH_R
Defines the maximum page width that you negotiate. This does not necessarily mean that either your modem or the remote will be limited to this size for receive. The default is G3 A4.

WIDTH_R = 0

PAGE_R
Defines the maximum page length you negotiate for receive, the default is unlimited.

PAGE_R = 2

I can see no practical reason for change this unless you have particular antipathy towards members of the legal profession.

How text2g3 handles page sizes

Page size parameters in text2g3 are taken from the WIDTH_S, PAGE_S (and LEFTMARGIN) keywords in 'qfax_dat', but you can override these using the -w -h and -l command line options.

-w
page width in G3 Key values (0,1,2)
-h
page length in G3 Key values (0,1,2)
-l
left margin in G3 pixel units.

Although text2g3 will fill a page size to extreme margins, many "standalone" fax machines will not print to these margins. The header margins used by text2g3, (60 pixels), should be considered a minimum.

Using the standard text2g3 default left margin of 160 pixels and assuming and equivalent right margin and a standard QFAX ID-line, then the page sizes in character sizes (for the default font) are approximately.

A4      85 characters x 67 lines
B4     101 characters x 85 lines
303mm  124 characters x (Approximately 524200 lines in unlimited)

text2g3 pages the fax by inserting RTC code words at the pixel line counts given in table 1.0. The page size and width parameters are stored in the header, as is the number of pages (RTC sequences inserted).

text2g3 v2.5 (and later) can include pages of varying size and resolution in a fax. This is described in section Header offset.

How qfax handles page size

qfax send uses the page size parameters in the header (from text2g3 or ps2g3 (ghostscript)) to negotiate with the remote device. The fax file is parsed during transmission and end of page negotiation invoked when an RTC sequence is found.

qfax receive uses the WIDTH_R and PAGE_R parameters to negotiate with the remote device. The negotiated parameters are stored in the file header. qfax recognises page breaks from data stream (DLE ETX); it will add RTC if the modem does not return it. The number of pages received in stored in the file header and the file name is recorded in the file 'INDIR_QFAX-lastfax', where INDIR is your top level inbound fax directory (IN_DIR). This is overwritten with each new fax, and is used by qfv and printfax for their "last fax" options.

How the decoder handles Page Size

The decoder is common to both qfv and printfax. It has undergone a number of changes for v2.x to cope with variable page sizes.

Faxes do not always conform to the sizes specified by the ITU-TSS. For example, I frequently receive faxes from a machine that I know is a manual, A4 page feed, that exceed the nominal 2286 pixel lines. The decoder is necessarily page based and uses a number of algorithms, including ratio of black to white pixels, number of scan lines, and proximity to next RTC or end of file to determine the validity of a potential page. These algorithms have proved reliable, but there may be faxes that break them.

The fax viewer, qfv, can "band" faxes into available memory. The printing utility, printfax, currently requires that contiguous memory is available for a complete fax page.

How qfv handles page size

When qfv starts up it tries to allocate page memory for the largest page size in the first fax file that it is to display. This has two effects, firstly it only uses memory as necessary and secondly, if you subsequently try to view a fax with a larger page size, qfv will "band" the fax to fit available memory.

You can force qfv to use a reduced memory allocation (thus saving memory and "banding" fax using the "-X memsize" option. The minimum value of "memsize" is 120000 bytes.

ex qfv;"-X 204800" : Use 200K for fax image decoding

qfv tries to be flexible in the allocation of page memory without being profligate or encouraging fragmentation; if your fax exceeds its claimed page size, then qfv will still attempt to allocate enough memory and display the fax.

Page and Paper sizes printfax

printfax uses a similar paging scheme to qfv. The page memory allocation is taken from the page dimensions recorded in the fax header, so printfax only ever takes sufficient memory for the fax it is printing. printfax however requires sufficient contiguous memory to decode the largest page in a fax.

printfax defaults to ISO A4 paper size on HP printers and 11in forms on Epson. The default paper size may be set using either the 'QFAX_DAT' PAPERSIZE key word, with values of A4, Letter or Legal.

PAPERSIZE = legal

The paper size may be defined (HP) by the printfax command line option -f, with numeric values of 0 = ISO A4, 1 = US Letter and 2 = US Legal. The way the printer handles different page and paper sizes depends on the model. Epson printer drivers do not currently support the PAPERSIZE keyword.

HP Printer features

Full support is provided for ISO A4 (297x210mm), US Letter (11x8.5in) and US Legal (14x8.5in) paper sizes. Faxes are always scaled with respect to the ITU-TSS width parameter to fit within the paper size. Faxes of ISO aspect ratio (sqrt(2) : 1), (G3 A4xA4, B4xB4, * x unlimited), i.e. the G3 width parameter is equal to the G3 page length parameter or the length is unlimited, are scaled to completely fit on either ISO A4 or US Letter paper depending on your PAPERSIZE setting (in this instance US Legal is considered to be US Letter, as the width is the scaling factor).

If the both the G3 width and the page length parameters are defined, then the scaling is taken from the width, and the printout is paged according to your paper size, so if you receive a G3 A4 wide, G3 B4 page length fax, and select US Legal paper, then each fax page will be printed on a single sheet. If you print the same fax on ISO A4 or US Letter paper, then each fax page will be printed over 2 sheets of paper with about the last 1/4 of the fax page on the second sheet. Each fax page will start on a new sheet.

When printfax takes the paper size from 'QFAX_DAT' (either defined or by default ISO A4), it assumes that the printer default is set for this size of paper. If you use the -f command line option to override the QFAX default, then printfax will send a printer command to use the -f selected paper size and send a printer command to set the paper size back to default when the fax has been printed.

printfax defaults to 300dpi on HP printers; 150dpi printing may be selected with the printer specific flag -s 2. This will be necessary to print A4 x B4 length fax to US Legal paper on a 1Mb LaserJet. The 150dpi algorithm has been chosen for ease of implementation and speed rather that quality, it is however (almost) readable.

All combinations of fax sizes may be printed with the -s 1 specific flag to print at pixel size. Note that at 303mm, unlimited (2432x3218) pixels, the last 32 pixels of each line are clipped by the printer and the page length will exceed the reproducible size on US Letter paper.

The -s flags may be OR'ed to do unscaled 150dpi printouts (-s 3).

Epson Printers

The Epson drivers only support A4 widths and will refuse to print anything wider. They will however print B4 lengths without introducing a page break. If this causes a problem on page printers (Stylus etc), please let me know, and a form feed will be added. A future release may support wider sizes. The Epson drivers currently ignore the PAPERSIZE parameter.

I do not have access an Epson printer printer of any description. A future release of QFAX will use external printer drivers, making user development of better drivers for hardware other than HP a more practical proposition.


Go to the first, previous, next, last section, table of contents.