Search documentation of wx

# View Source wxPrinter (wx v2.4.2)

Functions for wxPrinter class

This class represents the Windows or PostScript printer, and is the vehicle through which printing may be launched by an application.

Printing can also be achieved through using of lower functions and classes, but this and associated classes provide a more convenient and general method of printing.

See: Overview printing, `wxPrinterDC` (not implemented in wx), `wxPrintDialog`, `wxPrintout`, `wxPrintPreview`

wxWidgets docs: wxPrinter

# Summary

## Types

wxPrinter()

## Functions

createAbortWindow(This, Parent, Printout)

Creates the default printing abort window, with a cancel button.

destroy(This)

Destroys the object.

getAbort(This)

Returns true if the user has aborted the print job.

getLastError()

Return last error.

getPrintDialogData(This)

Returns the print data associated with the printer object.

new()
new(Options)

Constructor.

print(This, Parent, Printout)
print/4

Starts the printing process.

printDialog(This, Parent)

Invokes the print dialog.

reportError(This, Parent, Printout, Message)

Default error-reporting function.

setup(This, Parent)

Invokes the print setup dialog.

# Types

Link to this type

# wxPrinter()

View Source

    -type wxPrinter() :: wx:wx_object().

# Functions

Link to this function

# createAbortWindow(This, Parent, Printout)

View Source

    -spec createAbortWindow(This, Parent, Printout) -> wxDialog:wxDialog()
                               when
                                   This :: wxPrinter(),
                                   Parent :: wxWindow:wxWindow(),
                                   Printout :: wxPrintout:wxPrintout().

Creates the default printing abort window, with a cancel button.

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxPrinter()) -> ok.

Destroys the object.

Link to this function

# getAbort(This)

View Source

    -spec getAbort(This) -> boolean() when This :: wxPrinter().

Returns true if the user has aborted the print job.

Link to this function

# getLastError()

View Source

    -spec getLastError() -> wx:wx_enum().

Return last error.

Valid after calling `print/4`, `printDialog/2` or `wxPrintPreview:print/2`.

These functions set last error to `wxPRINTER_NO_ERROR` if no error happened.

Returned value is one of the following:

Link to this function

# getPrintDialogData(This)

View Source

    -spec getPrintDialogData(This) -> wxPrintDialogData:wxPrintDialogData() when This :: wxPrinter().

Returns the print data associated with the printer object.

Link to this function

# new()

View Source

    -spec new() -> wxPrinter().

Link to this function

# new(Options)

View Source

    -spec new([Option]) -> wxPrinter() when Option :: {data, wxPrintDialogData:wxPrintDialogData()}.

Constructor.

Pass an optional pointer to a block of print dialog data, which will be copied to the printer object's local data.

See: `wxPrintDialogData`, `wxPrintData`

Link to this function

# print(This, Parent, Printout)

View Source

    -spec print(This, Parent, Printout) -> boolean()
                   when
                       This :: wxPrinter(),
                       Parent :: wxWindow:wxWindow(),
                       Printout :: wxPrintout:wxPrintout().

Link to this function

# print/4

View Source

    -spec print(This, Parent, Printout, [Option]) -> boolean()
                   when
                       This :: wxPrinter(),
                       Parent :: wxWindow:wxWindow(),
                       Printout :: wxPrintout:wxPrintout(),
                       Option :: {prompt, boolean()}.

Starts the printing process.

Provide a parent window, a user-defined `wxPrintout` object which controls the printing of a document, and whether the print dialog should be invoked first.

`print/4` could return false if there was a problem initializing the printer device context (current printer not set, for example) or the user cancelled printing. Call `getLastError/0` to get detailed information about the kind of the error.

Link to this function

# printDialog(This, Parent)

View Source

    -spec printDialog(This, Parent) -> wxDC:wxDC() when This :: wxPrinter(), Parent :: wxWindow:wxWindow().

Invokes the print dialog.

If successful (the user did not press Cancel and no error occurred), a suitable device context will be returned; otherwise NULL is returned; call `getLastError/0` to get detailed information about the kind of the error.

Remark: The application must delete this device context to avoid a memory leak.

Link to this function

# reportError(This, Parent, Printout, Message)

View Source

    -spec reportError(This, Parent, Printout, Message) -> ok
                         when
                             This :: wxPrinter(),
                             Parent :: wxWindow:wxWindow(),
                             Printout :: wxPrintout:wxPrintout(),
                             Message :: unicode:chardata().

Default error-reporting function.

Link to this function

# setup(This, Parent)

View Source

    -spec setup(This, Parent) -> boolean() when This :: wxPrinter(), Parent :: wxWindow:wxWindow().

Invokes the print setup dialog.

Deprecated: The setup dialog is obsolete, though retained for backward compatibility.