Documentation for Win32lib v0.70.18
Table of Contents

Printing

These are routines that allow you to interact with the Printer.


  • proc abortDoc()   Abandons the print job, flushing anything created so far for it.
  • proc checkPrinter(integer release_if_exists)   Checks if a printer was chosen. Prompts the user if none found, or possibly release it.
  • func endDoc()   Ends the print job.
  • func endPage()   Ends the printing of the current page.
  • proc getDefaultPrinter()   Sets up the last printer used (or default printer) for printing
  • func getDefaultPrinterName()   Determines the name of the current default printer.
  • func getPageSetup()   Page setup dialog
  • func getPageSetupEx(atom Flags)   Page setup dialog
  • func getPrintChoice(integer pMaxPages, object pFlags, atom pPrintDlg)   Get the choices from a user before printing.
  • func getPrinter()    Get the Printer.
  • func getPrinterName()   Gets the current printer name.
  • proc newPrinter(sequence s,integer flag)   Sets up the printer whose friendly name is supplied.
  • proc releasePrinter()    Release the Printer, freeing it up for others to use.
  • func setPrintJobProperty(integer which,object new_value)   Gets, and possibly sets, a print job property.
  • func startDoc( sequence jobname )    Starts a new document on Printer.
  • func startPage()   Prepares the printer to begin a new page.

    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    abortDoc
    ()

    Abandons the print job, flushing anything created so far for it.

    Category: Printing

    Applications should call abortDoc() to cancel a print job.

    See Also: checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    checkPrinter
    (integer release_if_exists)

    Checks if a printer was chosen. Prompts the user if none found, or possibly release it.

    Category: Printing

    If the passed flag is 0, and there is a printer, it won't be released. If there is no printer, getPrinterChoice() will be invoked. If still no printer is selected, the procedure raises an error.

    See Also: abortDoc, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    endDoc
    ()

    Ends the print job.

    Returns: w32True if succeeds.

    Category: Printing

    Applications should call endDoc() when finished printing.

    Refer to Printer for details.

    See Also: abortDoc, checkPrinter, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    endPage
    ()

    Ends the printing of the current page.

    Returns: w32True if succeeds.

    Category: Printing

    Refer to Printer for details.

    See Also: abortDoc, checkPrinter, endDoc, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    getDefaultPrinter
    ()

    Sets up the last printer used (or default printer) for printing

    Category: Printing

    The other printing options are the onez that were set on the last printing attempt or subsequent calls to setPrintJobProperty().

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getDefaultPrinterName
    ()

    Determines the name of the current default printer.

    Returns: (STRING) "" on failure, printer name on success.

    Category: Printing

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getPageSetup
    ()

    Page setup dialog

    Returns: SEQUENCE: { paperSize, margins, orientation, papertype } or w32False if the user cancels

    Category: Printing

    This calls getPageSetupEx() using the default flags of ...

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getPageSetupEx
    (atom Flags)

    Page setup dialog

    Returns: SEQUENCE : { paperSize, margins , orientation, papertype} or w32False if the user cancels

    Category: Printing

    Flags are zero or more of these flags or'd together:

    Passing an empty sequence will use whatever last value iwas stored for the page setup flags.

    The return values are ...

  • paperSize: { x, y }
  • margins: {left, top, right, bottom }
  • orientation: Either DMORIENT_PORTRAIT or DMORIENT_LANDSCAPE.
  • papertype: The numeric code for the type of paper.

    This also sets the printer to the user's selection.

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getPrintChoice
    (integer pMaxPages, object pFlags, atom pPrintDlg)

    Get the choices from a user before printing.

    Returns: SEQUENCE: { startpage, endpage, copies, printerDC, collate, p2f, orient, paper }, or {} if user aborted.

    Category: Printing

    This pops up the "Select Printer" dialog for the user to select a printer from.

    pMaxPages specifies the maximum number of pages that a user can print, pFlags is additional flags for the dialog box. See the Microsoft documentation for details. It is either a sequence of flag values, in which case it replaces the default ones, or it is an atom of OR'd flags which are OR'd with the defaults (PD_ALLPAGES). If pFlags is {}, the current value for the JP_PrintFlags job property will be used.

    pPrintDlg is used for experts only. If zero, it is ignored. Otherwise it is the address of a PRINTDLG structure which has been correctly setup by the caller.

    The returned sequence has the starting and ending pages that the user selected. If these are both 0, then the user only wants the current document selection printed. If these are both -1, then the user wants all pages printed.

    copies is the number of copies to be printed.
    printerDC is the Printer's Device Context. This is not normally used directly but is available for advanced users.
    collate is w32True if the user wants the output collated.
    p2f is w32True if the user wants output to go to a file rather than the printer.
    orient is either DMORIENT_PORTRAIT or DMORIENT_LANDSCAPE.
    paper is the numeric code for the type of paper requested.
    flags is the state of the print dialog after user interaction.

    See also Printer

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getPrinter
    ()

    Get the Printer.

    Returns: SEQUENCE: { start page, end page, copies, printerDC, collate, p2f, orient, paper }, or {} if user aborted.

    Category: Printing

    This pops up the "Select Printer" dialog for the user to select a printer from. It defaults to a maximum of 999 pages.

    See getPrintChoice for details about this routine.

    See also Printer.

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    getPrinterName
    ()

    Gets the current printer name.

    Returns: (STRING) The current printer name.

    Category: Printing

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, newPrinter, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    newPrinter
    (sequence s,integer flag)

    Sets up the printer whose friendly name is supplied.

    Category: Printing

    If flag is set, all properties that had been set using setPrintJobProperty() will be applied to the new printer. Otherwise, the default new printer configuration will be in force.

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, releasePrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [proc]
    releasePrinter
    ()

    Release the Printer, freeing it up for others to use.

    Category: Printing

    The Printer must first be grabbed with getPrinter.

    Refer to Printer for details.

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, setPrintJobProperty, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    setPrintJobProperty
    (integer which,object new_value)

    Gets, and possibly sets, a print job property.

    Returns: Current/former value for the property.

    Category: Printing

    Using the w32GetValue pseudo value will cause the current property value to be returned without attempting to set it. This function is typically used after a call to newPrinter() to set a few settings without the user having to interact with a print/page setup dialog box. Changes will be effective on the next call to getPrinter().

    Recognised properties, and respective meanings of new_value, are:

  • JP_FromPage : the starting page number
  • JP_ToPage : the last page number
  • JP_MinPage : the minimum value allowed for the starting page number
  • JP_MaxPage : the maximum value allowed for the last page number
  • JP_Copies : the number of requested copies
  • JP_PrintFlags: the flags used to build the print dialog. Please refer to Microsoft documentation for more details on uses and values. Tge supported values are the PD_* values in w32constants.ew
  • JP_Orientation : either DMORIENT_PORTRAIT or DMORIENT_LANDSCAPE
  • JP_SetupFlags : the flags used to build the page setup dialog.
  • JP_PaperBin: the source of paper the printer is to use. Please refer to w32constants.ew for a list of supported DMBIN_* values.
  • JP_PaperSize: either a predefined DMPAPER_* constants in w32constants.ew, or a triple {length,width,unit}. Supported units are:
  • JP_Margins: a 5 element sequence {left margin,top margin,right margin,bottom margin,unit} where unit is as above.
  • JP_Collate: 0 to disable collation of multiple copies, any positive value to enable.

    The first properties (JP_From/To/Min/MaxPage) only affect the print dialog box, not the printer itself. You can control which pages are printed in the contents of a RichEdit control by using printRichEditPages(). In later versions, startPage() may be modified to take these parameters into account.

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, startDoc, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    startDoc
    ( sequence jobname )

    Starts a new document on Printer.

    Returns: INTEGER: w32True if succeeds.

    Category: Printing

    Start a new document on the Printer.
    The jobname parameter can either be the name of the job as seen by the system or { jobname, filename }. If filename is "", then the default of "FILE:" is used.

    If the filename is specified, the document is sent to the file rather than the printer device.
    If the filename is "FILE:" then the user will be prompted for the name of the file to use.

    Refer to Printer for details.

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startPage


    Documentation for Win32lib v0.70.18
    Table of Contents

    [func]
    startPage
    ()

    Prepares the printer to begin a new page.

    Returns: w32True if succeeds.

    Category: Printing

    Refer to Printer for details.

    See Also: abortDoc, checkPrinter, endDoc, endPage, getDefaultPrinter, getDefaultPrinterName, getPageSetup, getPageSetupEx, getPrintChoice, getPrinter, getPrinterName, newPrinter, releasePrinter, setPrintJobProperty, startDoc