📄 pclcap.c
字号:
/****************************************************************************** File: $Id: pclcap.c,v 1.17 2001/03/08 09:17:51 Martin Rel $ Contents: Description of PCL printer capabilities and supporting functionality Author: Martin Lottermoser, Greifswaldstrasse 28, 38124 Braunschweig, Germany. E-mail: Martin.Lottermoser@t-online.de.******************************************************************************** ** Copyright (C) 2000, 2001 by Martin Lottermoser ** All rights reserved ** *******************************************************************************//* Configuration management identification */#ifndef lintstatic const char cm_id[] = "@(#)$Id: pclcap.c,v 1.17 2001/03/08 09:17:51 Martin Rel $";#endif/*****************************************************************************/#ifndef _XOPEN_SOURCE#define _XOPEN_SOURCE 500#endif/* Standard headers */#include "std.h"#include <assert.h>#include <string.h> /* for memset() */#include <stdlib.h>/* Special headers */#include "pclcap.h"#include "pclsize.h"/*****************************************************************************//* Number of elements in an array */#define array_size(a) (sizeof(a)/sizeof(a[0]))/* Distance in terms of pixels at 300 ppi */#define BP_PER_DOT (BP_PER_IN/300)/*****************************************************************************//* Lists of media dimensions supported by each model and the (monochrome raster mode) margins in force for them. Read the comments on 'pcl_PageSize' in pclgen.h before reading further. These data have been obtained from various sources. A number of inconsistencies and omissions, partially within a single source, indicate that this information is not entirely reliable. If you find more reliable information than the one used here or you discover an entry to be definitely wrong by doing a test on the printer in question, send me a message. The PCL documentation (TRG500, DJ3/4, DJ6/8 and DJ1120C) should be the most reliable and I have usually given it priority. Besides this I have used HP support documents (e.g., "HP DeskJet 660C Printer - Printable Regions", BPD02519), user manuals for individual printers, a support document covering a range of printers ("HP DeskJet and DeskWriter Printers - Printable Areas/Minimum Margins", BPD05054), and the "Software Developer's Guide for HP DeskJet Printer Drivers", May 1996 (called "DG" in what follows). The DG seems the least reliable. Apart from several internal inconsistencies (conversion between units), some strange data (unexplicably large top margins) and frequent deviations from the documentation for the series-500 Deskjets (TRG500), I also suspect that some of the sizes listed are not supported by the printer at the PCL level but are handled in the driver, i.e., the driver uses a PCL Page Size code other than the one belonging to the size requested. In addition, HP distinguishes at least between margins when printing from DOS and margins when printing in Windows (see, e.g., BPD02519 for the DJ 660C). The DG lists the Windows margins which are usually larger than the hardware margins. I assume the DOS margins to be the real hardware margins. A statement that the DeskJets 500 and 500C but not 510, 520, 540, 550C, 560C or any newer models load envelopes long edge first can be found on p. 24 of DG. In addition, BPD01246 describes how to load envelopes on the HP DeskJet, DeskJet Plus, DJ 500 and DJ 500C printers and it has to be done flap first, i.e., long edge first. Some care is necessary when inserting margin specifications. In particular for envelopes, older (pre-1997) HP documentation frequently gives them in landscape orientation instead of in portrait orientation as needed here (except when the MS_TRANSVERSE_FLAG is set). A useful rule of thumb: If the bottom margin is not the largest of the four margins but the left margin is, it's very likely landscape. The value should be around 0.5 in (ca. 12 mm).*/static const eprn_PageDescription /* Order of margins: left, bottom, right, top. */ hpdj3xx_sizes[] = { /* These are the page descriptions for the DeskJets Portable, 310, 320 and 340, taken from DJ3/4, pp. 1 and 20. When printing in colour, the bottom margin is larger by 50 d. Note that BPD05054 gives different margins. */ {ms_Letter, 75*BP_PER_DOT, 120*BP_PER_DOT, 75*BP_PER_DOT, 30*BP_PER_DOT}, {ms_Legal, 75*BP_PER_DOT, 120*BP_PER_DOT, 75*BP_PER_DOT, 30*BP_PER_DOT}, {ms_A4, 37*BP_PER_DOT, 120*BP_PER_DOT, 43*BP_PER_DOT, 30*BP_PER_DOT}, {ms_Executive, 75*BP_PER_DOT, 120*BP_PER_DOT, 75*BP_PER_DOT, 30*BP_PER_DOT}, {ms_none} }, hpdj400_sizes[] = { /* These are the page descriptions for the DeskJet 400 taken from DJ3/4, pp. 1 and 21, and are stated to be valid valid for black and colour. Page 21 contains the following statement: "The mechanism will physically shift the page image downwards by a nominal 0.08 inch (2.0 mm)." I conclude this to mean that the real top margin is 0.08 inch instead of zero as specified and that the real bottom margin is smaller than specified by 0.08 inch. Note that BPD05054 gives different margins. */ {ms_Letter, 0.25*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 0.25*BP_PER_IN, 0.08*BP_PER_IN}, {ms_Legal, 0.25*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 0.25*BP_PER_IN, 0.08*BP_PER_IN}, {ms_A4, 0.125*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 3.6*BP_PER_MM, 0.08*BP_PER_IN}, {ms_Executive, 0.25*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 0.25*BP_PER_IN, 0.08*BP_PER_IN}, {ms_JISB5, 3.175*BP_PER_MM, (0.5-0.08)*BP_PER_IN, 3.25*BP_PER_MM, 0.08*BP_PER_IN}, /* DJ3/4 p. 21: "Envelopes are printed in the landscape mode". As the margins are given such that the largest value is designated as "bottom" and the bottom is designated on page 19 as a long edge, I conclude that the DJ 400 feeds envelopes long edge first. The list on p. 1 gives the dimensions for Env10 in portrait and EnvDL in landscape orientation. */ {ms_Env10 | MS_TRANSVERSE_FLAG, 0.125*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 0.08*BP_PER_IN, 0.08*BP_PER_IN}, {ms_EnvDL | MS_TRANSVERSE_FLAG, 0.125*BP_PER_IN, (0.5-0.08)*BP_PER_IN, 0.11*BP_PER_IN, 0.08*BP_PER_IN}, {ms_none} }, hpdj500_sizes[] = { /* These are taken from the TRG500 p. 1-18 except for No. 10 envelopes which are supported according to p. 3-2 and where I took the margins from BPD05054. The resulting collection agrees with BPD05054 which declares it to be valid for the HP DeskJet and the HP DeskJet Plus as well. Order of margins: left, bottom, right, top. */ {ms_Letter, 0.25*BP_PER_IN, 0.57*BP_PER_IN, 0.25*BP_PER_IN, 0.1*BP_PER_IN}, {ms_Legal, 0.25*BP_PER_IN, 0.57*BP_PER_IN, 0.25*BP_PER_IN, 0.1*BP_PER_IN}, {ms_A4, 3.1*BP_PER_MM, 0.57*BP_PER_IN, 3.6*BP_PER_MM, 0.1*BP_PER_IN}, {ms_Env10 | MS_TRANSVERSE_FLAG, /* Margins from BPD05054 */ 0.75*BP_PER_IN, 0.57*BP_PER_IN, 0.75*BP_PER_IN, 0.1*BP_PER_IN}, {ms_none} }, hpdj500c_sizes[] = { /* The data are from the TRG500 pp. 1-18 and 1-19 except for No. 10 envelopes which are supported according to p. 3-2 and which I took from BPD05054. The values listed in both documents agree. These are the values for the black cartridge; the CMY cartridge needs 0.17 inches more at the bottom. Order of margins: left, bottom, right, top. */ {ms_Letter, 0.25*BP_PER_IN, 0.4*BP_PER_IN, 0.25*BP_PER_IN, 0.1*BP_PER_IN}, {ms_Legal, 0.25*BP_PER_IN, 0.4*BP_PER_IN, 0.25*BP_PER_IN, 0.1*BP_PER_IN}, {ms_A4, 3.1*BP_PER_MM, 0.4*BP_PER_IN, 3.6*BP_PER_MM, 0.1*BP_PER_IN}, {ms_Env10 | MS_TRANSVERSE_FLAG, /* Margins from BPD05054, but I've chosen 0.4 in for the bottom margin instead of 0.57 in as listed there because it looks to me like the colour bottom. Compare with the DJ 500. */ 0.75*BP_PER_IN, 0.4*BP_PER_IN, 0.75*BP_PER_IN, 0.1*BP_PER_IN}, {ms_none} }, common_sizes[] = { /* DJs 510, 520, 550C und 560C for printing in black */ /* The data are from the TRG500 p. 1-19 except for envelopes which are supported according to p. 3-2 and where I took the margins from BPD05054. The values listed in both documents agree. For colour, the bottom margin must be increased by 0.13 inches. Order of margins: left, bottom, right, top. */ {ms_Letter, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Legal, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Executive, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.20*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A4, 3.1*BP_PER_MM, 0.46*BP_PER_IN, 3.6*BP_PER_MM, 0.04*BP_PER_IN}, /* Envelopes are supported according the TRG500, the margins are from BPD05054. */ {ms_Env10, /* given in landscape by HP */ 0.123*BP_PER_IN, 0.71*BP_PER_IN, 0.125*BP_PER_IN, 0.04*BP_PER_IN}, {ms_EnvDL, /* given in landscape by HP */ 3.1*BP_PER_MM, 18.0*BP_PER_MM, 3.6*BP_PER_MM, 1.0*BP_PER_MM}, {ms_none} }, hpdj540_sizes[] = { /* The data are from the TRG500 pp. 1-20 and 1-21 except that I have used a top margin of 0.04 inch from the DG instead of zero from the TRG500. Taking into account that the bottom margin is larger by 0.13 inches in colour, the resulting data agree with those in the DG, pp. 65-66. Order of margins: left, bottom, right, top. */ {ms_Executive, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Letter, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Legal, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A4, 3.2*BP_PER_MM, 11.7*BP_PER_MM, 3.2*BP_PER_MM, 0.04*BP_PER_IN}, {ms_A5, 3.2*BP_PER_MM, 18.0*BP_PER_MM, 3.2*BP_PER_MM, 0.04*BP_PER_IN}, {ms_JISB5, 4.2*BP_PER_MM, 11.7*BP_PER_MM, 4.2*BP_PER_MM, 0.04*BP_PER_IN}, {ms_Index4x6in, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Index5x8in, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A6 | PCL_CARD_FLAG, 3.2*BP_PER_MM, 18.0*BP_PER_MM, 3.2*BP_PER_MM, 0.04*BP_PER_IN}, {ms_Env10, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, /* given in landscape by HP */ {ms_EnvDL, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, /* given in landscape by HP */ {ms_EnvC6, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, /* given in landscape by HP */ {ms_Postcard, 4.2*BP_PER_MM, 18.0*BP_PER_MM, 4.2*BP_PER_MM, 0.04*BP_PER_IN}, {ms_none} }, hpdj660c_sizes[] = { /* These are taken from "HP DeskJet 660C Printer - Printable Regions", BPD02519, 1996 (obtained in March 1997), except that I've again increased the top margin from zero to 0.04 inches following BPD05054 and DG pp. 69-70. These are the values for printing in black from DOS. Colour printing increases the bottom margin by 0.13 inch. Adding this value reproduces the data from BPD05054 and the DG. This is, however, a contradiction with DG because BPD02519 gives different values for printing from Windows. */ {ms_Letter, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Legal, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Executive, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A4, 0.13*BP_PER_IN, 0.46*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A5, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_JISB5, 0.17*BP_PER_IN, 0.46*BP_PER_IN, 0.17*BP_PER_IN, 0.04*BP_PER_IN}, /* The bottom margin for JISB5 is given with large differences. BPD02519 specifies it as 0.46 in for black from DOS, 0.59 in DOS/colour (agreeing with +0.13 in for 'bottom_increment') and the same for Windows black or colour. BPD05054 gives 0.84 in without distinguishing between black and colour, and the DG gives 0.59 in. */ {ms_Env10, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, /* given in landscape by HP */ {ms_EnvDL, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, /* given in landscape by HP */ {ms_EnvC6, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, /* given in landscape by HP */ {ms_Index4x6in, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Index5x8in, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A6 | PCL_CARD_FLAG, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Postcard, 0.17*BP_PER_IN, 0.71*BP_PER_IN, 0.17*BP_PER_IN, 0.04*BP_PER_IN}, {ms_EnvUS_A2, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, /* Supported (BPD02925, BPD05054, DG), margins from BPD05054 agreeing with DG p. 70 */ {ms_none} }, hpdj680c_sizes[] = { /* For a change, these data are taken from the DG pp. 73-74. It is assumed that they are there given for colour printing and that the additional bottom margin included is 0.13 inches. Except for banner printing which is not supported by the DJ 660C, this gives identical margins as those for the DJ 660C. These data also almost agree with the German printer manual, Hewlett Packard "Weitere Informationen ueber den HP DeskJet 690C Series-Drucker" 1. Auflage, September 1996 Bestellnummer C4562-60105, Artikelnummer C4562-90160 for the DJ 690C. The difference is at most 0.31 mm except for the bottom margin in the case of JIS B5 which is given as 21.2 mm instead of 14.9 mm (0.83 in vs. 0.59 in). The DJ 690C does support banner printing (DJ6/8 p. 9). */ {ms_Letter, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A4, 0.13*BP_PER_IN, 0.46*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Legal, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Env10, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_Executive, 0.25*BP_PER_IN, 0.46*BP_PER_IN, 0.25*BP_PER_IN, 0.04*BP_PER_IN}, {ms_EnvDL, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN}, {ms_A5, 0.13*BP_PER_IN, 0.71*BP_PER_IN, 0.13*BP_PER_IN, 0.04*BP_PER_IN},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -