{Begin Chapter Hardcopy Facilities} {Title Hardcopy Facilities} {Text {index *PRIMARY* Hardcopy facilities} {index *PRIMARY* Printing documents} {index *PRIMARY* Document printing} Interlisp-D includes facilities for generating hardcopy in {index Interpress format}"Interpress" format and "Press" format. Interpress is a file format used for communicating documents to Xerox Network System printers such as the Xerox 8044 and Xerox 5700. {index Press format}Press is a file format used for communicating documents to Xerox laser Xerographic printers known by the names "Dover", "Spruce", "Penguin", and "Raven". There are also library packages available for supporting other types of printer formats (4045, FX-80, C150, etc.). The hardcopy facilities are designed to allow the user to support new types of printers with minimal changes to the user interface. Files can be in a number of formats, including Interpress files, plain text files, and formatted Tedit files. In order to print a file on a given printer, it is necessary to identify the format of the file, convert the file to a format that the printer can accept, and transmit it. Rather than require that the user explicitly determine file types and do the conversion, the Interlisp-D hardcopy functions generate Interpress or other format output depending on the appropriate choice for the designated printer. The hardcopy functions use the variables {var PRINTERTYPES} and {var PRINTFILETYPES} (described below) to determine the type of a file, how to convert it for a given printer, and how to send it. By changing these variables, the user can define other kinds of printers and print to them using the normal hardcopy functions. {FnDef {Name SEND.FILE.TO.PRINTER} {Args FILE HOST PRINTOPTIONS} {Text The function {fn SEND.FILE.TO.PRINTER} causes the file {arg FILE} to be sent to the printer {arg HOST}. If {arg HOST} is {lisp NIL}, the first host in the list {var DEFAULTPRINTINGHOST} which can print {arg FILE} is used. {arg PRINTOPTIONS} is a property list of the form {lisp ({arg PROP1} {arg VALUE1} {arg PROP2} {arg VALUE2} {ellipsis})}. The properties accepted depends on the type of printer. For {index Interpress format}Interpress printers, the following properties are accepted: {begin labeledList NSPRINT options} {label {lisp DOCUMENT.NAME}} {text The document name to appear on the header page (a string). Default is the full name of the file.} {label {lisp DOCUMENT.CREATION.DATE}} {text The creation date to appear on the header page (a Lisp integer date, such as returned by {fn IDATE}). The default value is the creation date of the file.} {label {lisp SENDER.NAME}} {text The name of the sender to appear on the header page (a string). The default value is the name of the user.} {label {lisp RECIPIENT.NAME}} {text The name of the recipient to appear on the header page (a string). The default is none.} {label {lisp MESSAGE}} {text An additional message to appear on the header page (a string). The default is none.} {label {lisp #COPIES}} {text The number of copies to be printed. The default value is 1.} {label {lisp PAGES.TO.PRINT}} {text The pages of the document that should be printed, represented as a list {lisp ({arg FIRSTPAGE#} {arg LASTPAGE#})}. For example, if this option is {lisp (3 5)}, this specifies that pages 3 through 5, inclusive, should be printed. Note that the page numbering used for this purpose has no connection to any page numbers that may be printed on the document. The default is to print all of the pages in the document.} {label {lisp MEDIUM}} {text The medium on which the master is to be printed. If omitted, this defaults to the value of {var NSPRINT.DEFAULT.MEDIUM}{index NSPRINT.DEFAULT.MEDIUM Var}, as follows: {lisp NIL} means to use the printer's default; {lisp T} means to use the first medium reported available by the printer; any other value must be a Courier value of type {lisp MEDIUM}. The format of this type is a list {lisp (PAPER (KNOWN.SIZE {arg TYPE}))} or {lisp (PAPER (OTHER.SIZE ({arg WIDTH} {arg LENGTH})))}. The paper {arg TYPE} is one of {lisp US.LETTER}, {lisp US.LEGAL}, {lisp A0} through {lisp A10}, {lisp ISO.B0} through {lisp ISO.B10}, and {lisp JIS.B0} through {lisp JIS.B10}. For users who use A4 paper exclusively, it should be sufficient to set {var NSPRINT.DEFAULT.MEDIUM} to {lisp (PAPER (KNOWN.SIZE "A4"))}. When using different paper sizes, it may be necessary to reset the variable {var DEFAULTPAGEREGION},{index DEFAULTPAGEREGION Var} the region on the page used for printing (measured in micas from the lower-left corner). } {label {lisp STAPLE?}} {text True if the document should be stapled.} {label {lisp #SIDES}} {text 1 or 2 to indicate that the document should be printed on one or two sides, respectively. The default is the value of {var EMPRESS#SIDES}{index EMPRESS#SIDES var}.} {label {lisp PRIORITY}} {text The priority of this print request, one of {lisp LOW}, {lisp NORMAL}, or {lisp HIGH}. The default is the printer's default.} {end labeledList NSPRINT options} Note: {index Press format}Press printers only recognize the options {lisp #COPIES}, {lisp #SIDES}, {lisp DOCUMENT.CREATION.DATE}, and {lisp DOCUMENT.NAME}. For example, {lispcode (SEND.FILE.TO.PRINTER 'FOO NIL '(#COPIES 3 #SIDES 2 DOCUMENT.NAME "For John"))} {fn SEND.FILE.TO.PRINTER} calls {fn PRINTERTYPE} and {fn PRINTFILETYPE} to determine the printer type of {arg HOST} and the file format of {arg FILE}. If {arg FILE} is a formatted file already in a form that the printer can print, it is transmitted directly. Otherwise, {index CONVERT.FILE.TO.TYPE.FOR.PRINTER Fn}{fn CONVERT.FILE.TO.TYPE.FOR.PRINTER} is called to do the conversion. [Note: If the file is converted, {arg PRINTOPTIONS} is passed to the formatting function, so it can include properties such as {lisp HEADING}, {lisp REGION}, and {lisp FONTS}.] All of these functions use the lists {var PRINTERTYPES} and {var PRINTFILETYPES} to actually determine how to do the conversion. {fn LISTFILES} ({PageRef Fn LISTFILES}) calls the function {fn LISTFILES1} to send a single file to a hardcopy printing device. Interlisp-D is initialized with {fn LISTFILES1} defined to call {fn SEND.FILE.TO.PRINTER}. }} {Fndef {name HARDCOPYW} {args WINDOW/BITMAP/REGION FILE HOST SCALEFACTOR ROTATION PRINTERTYPE} {text Creates a hardcopy file from a bitmap and optionally sends it to a printer. Note that some printers may have limitations concerning how big or how "complicated" the bitmap may be printed. {arg WINDOW/BITMAP/REGION} can either be a {lisp WINDOW} (open or closed), a {lisp BITMAP}, or a {lisp REGION} (interpreted as a region of the screen). If {arg WINDOW/BITMAP/REGION} is {lisp NIL}, the user is prompted for a screen region using {fn GETREGION}. If {arg FILE} is non-{lisp NIL}, it is used as the name of the file for output. If {arg HOST}={lisp NIL}, this file is not printed. If {arg FILE} is {lisp NIL}, a temporary file is created, and sent to {arg HOST}. To save an image on a file without printing it, perform {lisp (HARDCOPYW {arg IMAGE} {arg FILE})}. To print an image to the printer {arg PRINTER} without saving the file, perform {lisp (HARDCOPYW {arg IMAGE} NIL {arg PRINTER})}. If both {arg FILE} and {arg HOST} are {lisp NIL}, the default action is to print the image, without saving the file. The printer used is determined by the argument {arg PRINTERTYPE} and the value of the variable {var DEFAULTPRINTINGHOST}. If {arg PRINTERTYPE} is non-{lisp NIL}, the first host on {var DEFAULTPRINTINGHOST} of the type {arg PRINTERTYPE} is used. If {arg PRINTERTYPE} is {lisp NIL}, the first printer on {var DEFAULTPRINTINGHOST} that implements the {lisp BITMAPSCALE} (as determined by {var PRINTERTYPES}, {PageRef Var PRINTERTYPES}) operation is used, if any. Otherwise, the first printer on {var DEFAULTPRINTINGHOST} is used. The type of hardcopy file produced is determined by {arg HOST} if non-{lisp NIL}, else by {arg PRINTERTYPE} if non-{lisp NIL}, else by the value of {var DEFAULTPRINTINGHOST}, as described above. {arg SCALEFACTOR} is a reduction factor. If not given, it is computed automatically based on the size of the bitmap and the capabilities of the printer type. This may not be supported for some printers. {arg ROTATION} specifies how the bitmap image should be rotated on the printed page. Most printers (including Interpress printers) only support a {arg ROTATION} of multiples of 90. {arg PRINTERTYPE} specifies what type of printer to use when {arg HOST} is {lisp NIL}. {fn HARDCOPYW} uses this information to select which printer to use or what print file format to convert the output into, as described above. The background menu contains a "Hardcopy" command ({PageRef (Background Menu Command) Hardcopy}) that prompts the user for a region on the screen, and sends the image to the default printer. }} Hardcopy output may also be obtained by writing a file on the printer device {lisp LPT},{index LPT (printer device)} e.g. {lisp (COPYFILE 'FOO '{bracket LPT})}. When a file on this device is closed, it is converted to Interpress or some other format (if necessary) and sent to the default printer (the first host on {arg DEFAULTPRINTINGHOST}). One can include the printer name directly in the file name, e.g. {lisp (COPYFILE 'FOO {bracket LPT}TREMOR:)} will send the file to the printer {lisp TREMOR:}. {FnDef {Name PRINTERSTATUS} {Args PRINTER} {Text Returns a list describing the current status of the printer named {arg PRINTER}. The exact form of the value returned depends on the type of printer. For Interpress printers, the status describes whether the printer is available or busy or needs attention, and what type of paper is loaded in the printer. Returns {lisp NIL} if the printer does not respond in a reasonable time, which can occur if the printer is very busy, or does not implement the printer status service. }} {VarDef {Name DEFAULTPRINTINGHOST} {Text The variable {var DEFAULTPRINTINGHOST} is used to designate the default printer to be used as the output of printing operations. It should be a list of the known printer host names, for example, {lisp (QUAKE LISPPRINT:)}. If an element of {var DEFAULTPRINTINGHOST} is a list, is interpreted as {lisp ({arg PRINTERTYPE} {arg HOST})}, specifying both the host type and the host name. The type of the printer, which determines the protocol used to send to it and the file format it requires, is determined by the function {fn PRINTERTYPE}. If {var DEFAULTPRINTINGHOST} is a single printer name, it is treated as if it were a list of one element. }} {FnDef {Name PRINTFILETYPE} {Args FILE {anonarg}} {Text Returns the format of the file {arg FILE}. Possible values include {lisp INTERPRESS}, {lisp TEDIT}, etc. If it cannot determine the file type, it returns {lisp NIL}. Uses the global variable {lisp PRINTFILETYPES}. }} {FnDef {Name PRINTERTYPE} {args HOST} {Text Returns the type of the printer {arg HOST}. Currently uses the following heuristic: (1) If {arg HOST} is a list, the {fn CAR} is assumed to be the printer type and {fn CADR} the name of the printer; (2) If {arg HOST} is a litatom with a non-{lisp NIL} {index *PRIMARY* PRINTERTYPE Prop}{lisp PRINTERTYPE} property, the property value is returned as the printer type; (3) If {arg HOST} contains a colon (e.g., {lisp PRINTER:PARC:XEROX}) it is assumed to be an {lisp INTERPRESS} printer; (4) if {arg HOST} is the {fn CADR} of a list on {var DEFAULTPRINTINGHOST}, the {fn CAR} is returned as the printer type; (5) otherwise, the value of {index *PRIMARY* DEFAULTPRINTERTYPE Var}{var DEFAULTPRINTERTYPE} is returned as the printer type. }} {Begin SubSec Low-level Hardcopy Variables} {Title Low-level Hardcopy Variables} {Text The following variables are used to define how Interlisp should generate hardcopy of different types. The user should only need to change these variables when it is necessary to access a new type of printer, or define a new hardcopy document type (not often). {VarDef {Name PRINTERTYPES} {Text The characteristics of a given printer are determined by the value of the list {var PRINTERTYPES}. Each element is a list of the form {lispcode ({arg TYPES} ({arg PROPERTY1} {arg VALUE1}) ({arg PROPERTY2} {arg VALUE2}) {ellipsis})} {arg TYPES} is a list of the printer types that this entry addresses. The {lisp ({arg PROPERTYn} {arg VALUEn})} pairs define properties associated with each printer type. The printer properties include the following: {Begin LabeledList PRINTERTYPES properties} {Label {lisp CANPRINT}} {Text Value is a list of the file types that the printer can print directly. } {Label {lisp STATUS}} {Text Value is a function that knows how to find out the status of the printer, used by {fn PRINTERSTATUS} ({PageRef Fn PRINTERSTATUS}). } {Label {lisp PROPERTIES}} {Text Value is a function which returns a list of known printer properties. } {Label {lisp SEND}} {Text Value is a function which invokes the appropriate protocol to send a file to the printer. } {Label {lisp BITMAPSCALE}} {Text Value is a function of arguments {arg WIDTH} and {arg HEIGHT} in bits which returns a scale factor for scaling a bitmap. } {Label {lisp BITMAPFILE}} {Text Value is a form which, when evaluated, converts a bitmap to a file format that the printer will accept. } {End LabeledList PRINTERTYPES properties} Note: {index Interpress format}The name {index 8044 (Printer type)}{lisp 8044} is defined on {var PRINTERTYPES} as a synonym for the {lisp INTERPRESS} printer type. {index Press format}The names {index SPRUCE (Printer type)}{lisp SPRUCE}, {index PENGUIN (Printer type)}{lisp PENGUIN}, and {index DOVER (Printer type)}{lisp DOVER} are defined on {var PRINTERTYPES} as synonyms for the {lisp PRESS} printer type. The printer types {index FULLPRESS (Printer type)}{lisp FULLPRESS} and {index RAVEN (Printer type)}{lisp RAVEN} are also defined the same as {lisp PRESS}, except that these printer types indicate that the printer is a "Full Press" printer that is able to scale bitmap images, in addition to the normal Press printer facilities. }} {VarDef {Name PRINTFILETYPES} {Text The variable {var PRINTFILETYPES} contains information about various file formats, such as Tedit files and Interpress files. The format is similar to {var PRINTERTYPES}. The properties that can be specified include: {Begin LabeledList PRINTFILETYPES properties} {Label {lisp TEST}} {Text Value is a function which tests a file if it is of the given type. Note that this function is passed an open stream. } {Label {lisp CONVERSION}} {Text Value is a property list of other file types and funcitons that convert from the specified type to the file format. } {Label {lisp EXTENSION}} {Text Value is a list of possible file extensions for files of this type. } {End LabeledList PRINTFILETYPES properties} }} {Begin Note} From Intermezzo Release Notes: Star-compatible Interpress filetype used when creating, detecting Interpress files on NS file servers Files on NS file servers have an associated numerical file type. Interlisp does not normally use these file types, although the user can read and set them (using the FILETYPE file attribute). However, this causes problems when accessing files from the Star workstation, which does use the filetypes. Specifically, Star didn't recognize Interpress files generated from Interlisp, because they didn't have the right filetype (4361). Therefore, Interlisp now creates Interpress files with the standard Interpress filetype. This filetype is also used in INTERPRESSFILEP to quickly detect whether a file is an Interpress file: if the filetype is correct, Interlisp won't try parsing the file to see if it is a valid Interpress file. {End Note} }{End SubSec Low-level Hardcopy Variables} }{End Chapter Hardcopy Facilities} ?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) ?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) >8>8zē