OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TPrinter Class Reference

TPrinter is an encapsulation around the Windows printer device interface, and represents the physical printer device. More...

#include <owl/printer.h>

Inheritance diagram for owl::TPrinter:
owl::TStreamableBase

Classes

class  TDevMode
 Contains information about the initialization and environment of a printer device. More...
 

Public Types

enum  TCapability {
  dcBinNames = DC_BINNAMES , dcBins = DC_BINS , dcCollate = DC_COLLATE , dcColorDevice = DC_COLORDEVICE , dcCopies = DC_COPIES , dcDriver = DC_DRIVER , dcDuplex = DC_DUPLEX , dcEnumResolutions = DC_ENUMRESOLUTIONS , dcExtra = DC_EXTRA , dcFields = DC_FIELDS ,
  dcFileDependencies = DC_FILEDEPENDENCIES , dcMaxExtent = DC_MAXEXTENT , dcMediaReady = DC_MEDIAREADY , dcMediaTypeNames = DC_MEDIATYPENAMES , dcMediaTypes = DC_MEDIATYPES , dcMinExtent = DC_MINEXTENT , dcOrientation = DC_ORIENTATION , dcNup = DC_NUP , dcPaperNames = DC_PAPERNAMES , dcPapers = DC_PAPERS ,
  dcPaperSize = DC_PAPERSIZE , dcPersonality = DC_PERSONALITY , dcPrinterMem = DC_PRINTERMEM , dcPrintRate = DC_PRINTRATE , dcPrintRatePpm = DC_PRINTRATEPPM , dcPrintRateUnit = DC_PRINTRATEUNIT , dcSize = DC_SIZE , dcStaple = DC_STAPLE , dcTrueType = DC_TRUETYPE , dcVersion = DC_VERSION
}
 Encapsulates the capability constants defined for the Windows API function DeviceCapabilities. More...
 
Return types for capability accessors
enum  TPrintRateUnit { pruUnknown = 0 , pruPagesPerMinute = PRINTRATEUNIT_PPM , pruCharactersPerSecond = PRINTRATEUNIT_CPS , pruLinesPerMinute = PRINTRATEUNIT_LPM , pruInchesPerMinute = PRINTRATEUNIT_IPM }
 Return type for GetPrintRateUnit. More...
 
using TBinNames = std::vector<tstring>
 Return type for GetBinNames.
 
using TBins = std::vector<WORD>
 Return type for GetBins.
 
using TResolutions = std::vector<TSize>
 Return type for GetResolutions.
 
using TFileDependencies = std::vector<tstring>
 Return type for GetDriverDependencies.
 
using TPaperForms = std::vector<tstring>
 Return type for GetReadyMedia.
 
using TMediaTypeNames = std::vector<tstring>
 Return type for GetMediaTypeNames.
 
using TMediaTypes = std::vector<DWORD>
 Return type for GetMediaTypes.
 
using TNupConfigurations = std::vector<int>
 Return type for GetNupConfigurations.
 
using TPaperNames = std::vector<tstring>
 Return type for GetPaperNames.
 
using TPapers = std::vector<WORD>
 Return type for GetPapers.
 
using TPaperSizes = std::vector<TSize>
 Return type for GetPaperSizes.
 
using TDescriptionLanguages = std::vector<tstring>
 Return type for GetDescriptionsLanguages.
 

Public Member Functions

 TPrinter (const tstring &device=GetDefaultPrinter())
 Associates this TPrinter object with the given printer device.
 
 TPrinter (TPrinter &&other)
 Move-constructor; enables auto-declaration style.
 
virtual ~TPrinter ()
 Frees the resources allocated to TPrinter.
 
void SetDevice (const tstring &device)
 Assigns the device to be represented by this TPrinter object.
 
virtual void ClearDevice ()
 Called by the Destructor, ClearDevice disassociates the device with the current printer.
 
virtual void Setup (TWindow *parent)
 Setup lets the user select and/or configure the currently associated printer.
 
virtual bool Print (TWindow *parent, TPrintout &printout, bool prompt)
 Print renders the given printout object on the associated printer device and displays an Abort dialog box while printing.
 
virtual void ReportError (TWindow *parent, TPrintout &printout)
 Reports the current error by bringing up a system message box with an error message composed of the error description and document title.
 
TPrintDialog::TDataGetSetup ()
 Returns a reference to the TPrintDialog data structure.
 
auto GetSetup () const -> const TPrintDialog::TData &
 
auto GetDC () -> std::unique_ptr< TPrintDC >
 Returns the device context already obtained in our setup data, or if none, creates a new one based on the device name and device initialization data (DEVMODE).
 
int GetError ()
 Returns the error code from the printer.
 
TPrintDialog::TDataGetData ()
 Returns the common dialog data associated with the printer.
 
void SetData (TPrintDialog::TData *data)
 Sets the common dialog data; takes ownership.
 
TSize GetPageSize () const
 Returns the size of the page.
 
void SetPageSize (const TSize &pagesize)
 Sets the page's size.
 
TSize GetPageSizeInch () const
 Returns the size of an inch the page.
 
void SetPageSizeInch (const TSize &pageSizeInch)
 Sets the size of an inch on the page.
 
virtual void SetPageSizes (const TPrintDC &dc)
 Updates the PageSize variables by querying the device capabilities of the specified device context.
 
auto GetCapability (TCapability capability, TCHAR *output) const -> DWORD
 Get information about the device.
 
Retrieves/assigns the output file

The output file can be set to redirect the print job.

Set to blank to disable redirection (default).

LPCTSTR GetOutputFile () const
 Returns the filename for output redirection.
 
void SetOutputFile (const tstring &outputFile)
 Sets the filename for output redirection.
 
Capability accessors (type-safe encapsulations of GetCapability)


auto GetBinNames () const -> TBinNames
 Retrieves the names of the printer's paper bins.
 
auto GetBins () const -> TBins
 Retrieves a list of available paper bins.
 
auto CanCollate () const -> bool
 Returns whether the printer supports collating.
 
auto IsColorDevice () const -> bool
 Returns whether the printer supports color printing.
 
auto GetMaxCopies () const -> int
 Return the maximum number of copies the printer can print.
 
auto GetDriverVersion () const -> DWORD
 Returns the version number of the printer driver.
 
auto HasDuplexSupport () const -> bool
 Returns whether the printer supports duplex printing.
 
auto GetResolutions () const -> TResolutions
 Retrieves a list of the resolutions supported by the printer.
 
auto GetDevModeExtra () const -> int
 Returns the number of bytes required for the device-specific portion of the DEVMODE structure for the printer driver.
 
auto GetDevModeFields () const -> DWORD
 Returns the dmFields member of the printer driver's DEVMODE structure.
 
auto GetDriverDependencies () const -> TFileDependencies
 Returns the names of any additional files that need to be loaded for the printer driver.
 
auto GetMaxExtent () const -> TSize
 Returns the maximum paper size that the printer supports.
 
auto GetReadyMedia () const -> TPaperForms
 Returns the names of the paper forms that are currently available for use.
 
auto GetMediaTypeNames () const -> TMediaTypeNames
 Returns the names of the supported media types.
 
auto GetMediaTypes () const -> TMediaTypes
 Returns a list of supported media types.
 
auto GetMinExtent () const -> TSize
 Returns the minimum paper size that the printer supports.
 
auto GetLandscapeOrientation () const -> int
 Returns the angle of rotation between portrait and landscape orientation.
 
auto GetNupConfigurations () const -> TNupConfigurations
 Retrieves a list of integers that indicate the printers ability to print multiple document pages per printed page.
 
auto GetPaperNames () const -> TPaperNames
 Returns a list of supported paper names.
 
auto GetPapers () const -> TPapers
 Returns a list of supported paper sizes.
 
auto GetPaperSizes () const -> TPaperSizes
 Retrieves the dimensions of each supported paper size.
 
auto GetDescriptionLanguages () const -> TDescriptionLanguages
 Returns a list of printer description languages supported by the printer.
 
auto GetMemoryCapacity () const -> int
 Returns the amount of available printer memory, in kilobytes.
 
auto GetPrintRate () const -> int
 Returns the printer's print rate.
 
auto GetPrintRatePpm () const -> int
 Returns the printer's print rate in pages per minute.
 
auto GetPrintRateUnit () const -> TPrintRateUnit
 Returns the printer's print rate units.
 
auto GetDevModeSize () const -> int
 Returns the dmSize member of the printer driver's DEVMODE structure.
 
auto CanStaple () const -> bool
 Returns whether the printer supports stapling.
 
auto GetTrueTypeCapabilities () const -> DWORD
 Retrieves the abilities of the printer to use TrueType fonts.
 
auto GetDriverSpecificationVersion () const -> DWORD
 Returns the specification version to which the printer driver conforms.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Static Public Member Functions

static auto GetDefaultPrinter () -> tstring
 Retrieves the printer name of the default printer for the current user on the local computer.
 
static void SetUserAbort (HDC abortDC=HDC(-1))
 Sets the user abort DC for the printer.
 
static HDC GetUserAbort ()
 Returns the abort DC.
 

Protected Member Functions

virtual bool ExecPrintDialog (TWindow *parent)
 Virtual called from within Print() to construct and execute a print dialog before actual printing occurs.
 
virtual bool ExecPageSetupDialog (TWindow *parent)
 Page setup dialog for Win95 support.
 
virtual TWindowCreateAbortWindow (TWindow *parent, TPrintout &printout)
 Virtual called from withing Print() just before the main printing loop to construct and create the printing status, or abort window.
 

Detailed Description

TPrinter is an encapsulation around the Windows printer device interface, and represents the physical printer device.

To print or configure a printer, initialize an instance of TPrinter. To print a TPrintout, send the TPrintout to the TPrinter's Print function.

Examples:

defaultPrinter.Print(parent, printout, true); // Prompt.
auto pdfPrinter = TPrinter{"Microsoft Print to PDF"};
pdfPrinter.Print(nullptr, printout, false); // Do not prompt.
TPrinter is an encapsulation around the Windows printer device interface, and represents the physical...
Definition printer.h:164

Definition at line 163 of file printer.h.

Member Typedef Documentation

◆ TBinNames

Return type for GetBinNames.

Definition at line 287 of file printer.h.

◆ TBins

Return type for GetBins.

Definition at line 288 of file printer.h.

◆ TDescriptionLanguages

Return type for GetDescriptionsLanguages.

Definition at line 298 of file printer.h.

◆ TFileDependencies

Return type for GetDriverDependencies.

Definition at line 290 of file printer.h.

◆ TMediaTypeNames

Return type for GetMediaTypeNames.

Definition at line 292 of file printer.h.

◆ TMediaTypes

Return type for GetMediaTypes.

Definition at line 293 of file printer.h.

◆ TNupConfigurations

Return type for GetNupConfigurations.

Definition at line 294 of file printer.h.

◆ TPaperForms

Return type for GetReadyMedia.

Definition at line 291 of file printer.h.

◆ TPaperNames

Return type for GetPaperNames.

Definition at line 295 of file printer.h.

◆ TPapers

Return type for GetPapers.

Definition at line 296 of file printer.h.

◆ TPaperSizes

Return type for GetPaperSizes.

Definition at line 297 of file printer.h.

◆ TResolutions

Return type for GetResolutions.

Definition at line 289 of file printer.h.

Member Enumeration Documentation

◆ TCapability

Encapsulates the capability constants defined for the Windows API function DeviceCapabilities.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd183552.aspx

See also
GetCapability()
Enumerator
dcBinNames 
dcBins 
dcCollate 
dcColorDevice 
dcCopies 
dcDriver 
dcDuplex 
dcEnumResolutions 
dcExtra 
dcFields 
dcFileDependencies 
dcMaxExtent 
dcMediaReady 
dcMediaTypeNames 
dcMediaTypes 
dcMinExtent 
dcOrientation 
dcNup 
dcPaperNames 
dcPapers 
dcPaperSize 
dcPersonality 
dcPrinterMem 
dcPrintRate 
dcPrintRatePpm 
dcPrintRateUnit 
dcSize 
dcStaple 
dcTrueType 
dcVersion 

Definition at line 238 of file printer.h.

◆ TPrintRateUnit

Return type for GetPrintRateUnit.

Enumerator
pruUnknown 
pruPagesPerMinute 
pruCharactersPerSecond 
pruLinesPerMinute 
pruInchesPerMinute 

Definition at line 303 of file printer.h.

Constructor & Destructor Documentation

◆ TPrinter() [1/2]

owl::TPrinter::TPrinter ( const tstring & device = GetDefaultPrinter())
explicit

Associates this TPrinter object with the given printer device.

If no name is given, the name of the current default printer is used.

Definition at line 417 of file printer.cpp.

References SetDevice().

◆ TPrinter() [2/2]

owl::TPrinter::TPrinter ( TPrinter && other)

Move-constructor; enables auto-declaration style.

Definition at line 426 of file printer.cpp.

◆ ~TPrinter()

owl::TPrinter::~TPrinter ( )
virtual

Frees the resources allocated to TPrinter.

Definition at line 437 of file printer.cpp.

Member Function Documentation

◆ CanCollate()

auto owl::TPrinter::CanCollate ( ) const -> bool

Returns whether the printer supports collating.

If the function fails, false is returned.

See also
TCapability::dcCollate

Definition at line 622 of file printer.cpp.

References dcCollate, and GetCapability().

◆ CanStaple()

auto owl::TPrinter::CanStaple ( ) const -> bool

Returns whether the printer supports stapling.

If the function fails, false is returned.

See also
TCapability::dcStaple

Definition at line 960 of file printer.cpp.

References dcStaple, and GetCapability().

◆ ClearDevice()

void owl::TPrinter::ClearDevice ( )
virtual

Called by the Destructor, ClearDevice disassociates the device with the current printer.

ClearDevice changes the current status of the printer to PF_UNASSOCIATED, which causes the object to ignore all calls to Print until the object is reassociated with a printer.

Definition at line 554 of file printer.cpp.

References owl::TPrintDialog::TData::ClearDevMode(), and owl::TPrintDialog::TData::ClearDevNames().

◆ CreateAbortWindow()

TWindow * owl::TPrinter::CreateAbortWindow ( TWindow * parent,
TPrintout & printout )
protectedvirtual

Virtual called from withing Print() just before the main printing loop to construct and create the printing status, or abort window.

This window should use the control IDs specified in printer.rh

Definition at line 1046 of file printer.cpp.

References owl::TWindow::Create(), owl::TPrintDialog::TData::GetDeviceName(), owl::TPrintDialog::TData::GetOutputName(), owl::TPrintout::GetPrintDC(), and owl::TPrintout::GetTitle().

◆ ExecPageSetupDialog()

bool owl::TPrinter::ExecPageSetupDialog ( TWindow * parent)
protectedvirtual

Page setup dialog for Win95 support.

Definition at line 1027 of file printer.cpp.

References owl::TPrintDialog::TData::DoPageSetup, and owl::TDialog::Execute().

◆ ExecPrintDialog()

bool owl::TPrinter::ExecPrintDialog ( TWindow * parent)
protectedvirtual

Virtual called from within Print() to construct and execute a print dialog before actual printing occurs.

Return true to continue printing, false to cancel

Definition at line 1013 of file printer.cpp.

References owl::TDialog::Execute().

◆ GetBinNames()

auto owl::TPrinter::GetBinNames ( ) const -> TBinNames

Retrieves the names of the printer's paper bins.

If the function fails, an empty vector is returned.

See also
TCapability::dcBinNames

Definition at line 593 of file printer.cpp.

References dcBinNames.

◆ GetBins()

auto owl::TPrinter::GetBins ( ) const -> TBins

Retrieves a list of available paper bins.

Each element of the returned vector is a bin identifier, e.g. DMBIN_AUTO. See the description of the dmDefaultSource member of the DEVMODE structure. If the function fails, an empty vector is returned.

See also
TCapability::dcBins

Definition at line 605 of file printer.cpp.

References CHECK, dcBins, and GetCapability().

◆ GetCapability()

auto owl::TPrinter::GetCapability ( TCapability capability,
TCHAR * output ) const -> DWORD
inline

Get information about the device.

This is a wrapper for the Windows API function DeviceCapabilities. http://msdn.microsoft.com/en-us/library/windows/desktop/dd183552.aspx

Note
This function is not type-safe. Prefer the type-safe accessors instead.

Definition at line 278 of file printer.h.

◆ GetData()

TPrintDialog::TData * owl::TPrinter::GetData ( )

Returns the common dialog data associated with the printer.

Definition at line 501 of file printer.cpp.

◆ GetDC()

auto owl::TPrinter::GetDC ( ) -> std::unique_ptr<TPrintDC>

Returns the device context already obtained in our setup data, or if none, creates a new one based on the device name and device initialization data (DEVMODE).

Definition at line 466 of file printer.cpp.

References CHECK.

◆ GetDefaultPrinter()

auto owl::TPrinter::GetDefaultPrinter ( ) -> tstring
static

Retrieves the printer name of the default printer for the current user on the local computer.

Wrapper for the Windows API function GetDefaultPrinter. http://msdn.microsoft.com/en-us/library/windows/desktop/dd144876.aspx Throws TXPrinter if there is no default printer, or if an unexpected error occurs.

Definition at line 386 of file printer.cpp.

References _T, CHECK, and GetDefaultPrinter().

◆ GetDescriptionLanguages()

auto owl::TPrinter::GetDescriptionLanguages ( ) const -> TDescriptionLanguages

Returns a list of printer description languages supported by the printer.

If the function fails, an empty vector is returned.

See also
TCapability::dcPersonality

Definition at line 877 of file printer.cpp.

References dcPersonality.

◆ GetDevModeExtra()

auto owl::TPrinter::GetDevModeExtra ( ) const -> int

Returns the number of bytes required for the device-specific portion of the DEVMODE structure for the printer driver.

If the function fails, 0 is returned.

See also
TCapability::dcExtra

Definition at line 695 of file printer.cpp.

References dcExtra, and GetCapability().

◆ GetDevModeFields()

auto owl::TPrinter::GetDevModeFields ( ) const -> DWORD

Returns the dmFields member of the printer driver's DEVMODE structure.

The dmFields member indicates which members in the device-independent portion of the structure are supported by the printer driver.

See also
TCapability::dcFields

Definition at line 708 of file printer.cpp.

References dcFields, and GetCapability().

◆ GetDevModeSize()

auto owl::TPrinter::GetDevModeSize ( ) const -> int

Returns the dmSize member of the printer driver's DEVMODE structure.

The dmSize member indicates the size (and hence version) of the DEVMODE structure. The size excludes the private driver-data that follows the structure. See the dmDriverExtra member. If the function fails, 0 is returned.

See also
TCapability::dcSize

Definition at line 948 of file printer.cpp.

References dcSize, and GetCapability().

◆ GetDriverDependencies()

auto owl::TPrinter::GetDriverDependencies ( ) const -> TFileDependencies

Returns the names of any additional files that need to be loaded for the printer driver.

If the function fails, an empty vector is returned.

See also
TCapability::dcFileDependencies

Definition at line 718 of file printer.cpp.

References dcFileDependencies.

◆ GetDriverSpecificationVersion()

auto owl::TPrinter::GetDriverSpecificationVersion ( ) const -> DWORD

Returns the specification version to which the printer driver conforms.

If the function fails, 0xFFFFFFFF is returned.

See also
TCapability::dcVersion

Definition at line 983 of file printer.cpp.

References dcVersion, and GetCapability().

◆ GetDriverVersion()

auto owl::TPrinter::GetDriverVersion ( ) const -> DWORD

Returns the version number of the printer driver.

If the function fails, 0xFFFFFFFF is returned.

See also
TCapability::dcDriver

Definition at line 654 of file printer.cpp.

References dcDriver, and GetCapability().

◆ GetError()

int owl::TPrinter::GetError ( )

Returns the error code from the printer.

Definition at line 493 of file printer.cpp.

◆ GetLandscapeOrientation()

auto owl::TPrinter::GetLandscapeOrientation ( ) const -> int

Returns the angle of rotation between portrait and landscape orientation.

The result is given in terms of the number of degrees that portrait orientation is rotated counter-clockwise to produce landscape orientation. If landscape orientation is not supported, then 0 is returned. If the function fails, 0 is returned.

See also
TCapability::dcOrientation

Definition at line 794 of file printer.cpp.

References dcOrientation, and GetCapability().

◆ GetMaxCopies()

auto owl::TPrinter::GetMaxCopies ( ) const -> int

Return the maximum number of copies the printer can print.

If the function fails, 0 is returned.

See also
TCapability::dcCopies

Definition at line 642 of file printer.cpp.

References dcCopies, and GetCapability().

◆ GetMaxExtent()

auto owl::TPrinter::GetMaxExtent ( ) const -> TSize

Returns the maximum paper size that the printer supports.

If the function fails, TSize{0, 0} is returned.

See also
TCapability::dcMaxExtent, TCapability::dcMinExtent

Definition at line 728 of file printer.cpp.

References dcMaxExtent, GetCapability(), owl::HiInt16(), and owl::LoInt16().

◆ GetMediaTypeNames()

auto owl::TPrinter::GetMediaTypeNames ( ) const -> TMediaTypeNames

Returns the names of the supported media types.

If the function fails, an empty vector is returned.

See also
TCapability::dcMediaTypeNames

Definition at line 750 of file printer.cpp.

References dcMediaTypeNames.

◆ GetMediaTypes()

auto owl::TPrinter::GetMediaTypes ( ) const -> TMediaTypes

Returns a list of supported media types.

For a list of possible media type values, see the description of the dmMediaType member of the DEVMODE structure. If the function fails, an empty vector is returned.

See also
TCapability::dcMediaTypes

Definition at line 762 of file printer.cpp.

References CHECK, dcMediaTypes, and GetCapability().

◆ GetMemoryCapacity()

auto owl::TPrinter::GetMemoryCapacity ( ) const -> int

Returns the amount of available printer memory, in kilobytes.

If the function fails, 0 is returned.

See also
TCapability::dcPrinterMem

Definition at line 887 of file printer.cpp.

References dcPrinterMem, and GetCapability().

◆ GetMinExtent()

auto owl::TPrinter::GetMinExtent ( ) const -> TSize

Returns the minimum paper size that the printer supports.

If the function fails, TSize{0, 0} is returned.

See also
TCapability::dcMinExtent, TCapability::dcMaxExtent

Definition at line 779 of file printer.cpp.

References dcMinExtent, GetCapability(), owl::HiInt16(), and owl::LoInt16().

◆ GetNupConfigurations()

auto owl::TPrinter::GetNupConfigurations ( ) const -> TNupConfigurations

Retrieves a list of integers that indicate the printers ability to print multiple document pages per printed page.

Each element of the list represent a supported configuration, given by the number of document pages per printed page. If the function fails, an empty vector is returned.

See also
TCapability::dcNup

Definition at line 808 of file printer.cpp.

References CHECK, dcNup, and GetCapability().

◆ GetOutputFile()

LPCTSTR owl::TPrinter::GetOutputFile ( ) const

Returns the filename for output redirection.

Definition at line 1062 of file printer.cpp.

◆ GetPageSize()

TSize owl::TPrinter::GetPageSize ( ) const

Returns the size of the page.

Definition at line 519 of file printer.cpp.

◆ GetPageSizeInch()

TSize owl::TPrinter::GetPageSizeInch ( ) const

Returns the size of an inch the page.

Definition at line 535 of file printer.cpp.

◆ GetPaperNames()

auto owl::TPrinter::GetPaperNames ( ) const -> TPaperNames

Returns a list of supported paper names.

For example, paper names could be "Letter" or "Legal". If the function fails, an empty vector is returned.

See also
TCapability::dcPaperNames

Definition at line 827 of file printer.cpp.

References dcPaperNames.

◆ GetPapers()

auto owl::TPrinter::GetPapers ( ) const -> TPapers

Returns a list of supported paper sizes.

For a list of the possible element values, see the description of the dmPaperSize member of the DEVMODE structure. If the function fails, an empty vector is returned.

See also
TCapability::dcPapers

Definition at line 839 of file printer.cpp.

References CHECK, dcPapers, and GetCapability().

◆ GetPaperSizes()

auto owl::TPrinter::GetPaperSizes ( ) const -> TPaperSizes

Retrieves the dimensions of each supported paper size.

The unit is tenths of a millimeter (LOMETRIC). If the function fails, an empty vector is returned.

See also
TCapability::dcPaperSize

Definition at line 857 of file printer.cpp.

References CHECK, dcPaperSize, and GetCapability().

◆ GetPrintRate()

auto owl::TPrinter::GetPrintRate ( ) const -> int

Returns the printer's print rate.

Call GetCapability<TPrinter::dcPrintRateUnit> to determine the units of the returned value. If the function fails, 0 is returned.

See also
TCapability::dcPrintRate, TCapability::dcPrintRateUnit, TPrintRateUnit

Definition at line 900 of file printer.cpp.

References dcPrintRate, and GetCapability().

◆ GetPrintRatePpm()

auto owl::TPrinter::GetPrintRatePpm ( ) const -> int

Returns the printer's print rate in pages per minute.

If the function fails, 0 is returned.

See also
TCapability::dcPrintRatePpm

Definition at line 912 of file printer.cpp.

References dcPrintRatePpm, and GetCapability().

◆ GetPrintRateUnit()

auto owl::TPrinter::GetPrintRateUnit ( ) const -> TPrintRateUnit

Returns the printer's print rate units.

The returned value determines the units for the value returned by GetCapability<TPrinter::dcPrintRate>. If the function fails, pruUnknown is returned.

See also
TCapability::dcPrintRateUnit, TCapability::dcPrintRate, TPrintRateUnit

Definition at line 925 of file printer.cpp.

References dcPrintRateUnit, GetCapability(), pruCharactersPerSecond, pruInchesPerMinute, pruLinesPerMinute, pruPagesPerMinute, and pruUnknown.

◆ GetReadyMedia()

auto owl::TPrinter::GetReadyMedia ( ) const -> TPaperForms

Returns the names of the paper forms that are currently available for use.

If the function fails, an empty vector is returned.

See also
TCapability::dcMediaReady

Definition at line 740 of file printer.cpp.

References dcMediaReady.

◆ GetResolutions()

auto owl::TPrinter::GetResolutions ( ) const -> TResolutions

Retrieves a list of the resolutions supported by the printer.

If the function fails, an empty vector is returned.

See also
TCapability::dcEnumResolutions

Definition at line 674 of file printer.cpp.

References CHECK, dcEnumResolutions, and GetCapability().

◆ GetSetup() [1/2]

TPrintDialog::TData & owl::TPrinter::GetSetup ( )

Returns a reference to the TPrintDialog data structure.

Definition at line 457 of file printer.cpp.

◆ GetSetup() [2/2]

auto owl::TPrinter::GetSetup ( ) const -> const TPrintDialog::TData&
inline

Definition at line 204 of file printer.h.

References GetSetup().

◆ GetTrueTypeCapabilities()

auto owl::TPrinter::GetTrueTypeCapabilities ( ) const -> DWORD

Retrieves the abilities of the printer to use TrueType fonts.

The returned value can be a combination of flags DCTT_BITMAP, DCTT_DOWNLOAD and DCTT_SUBDEV. If the function fails, 0 is returned.

See also
TCapability::dcTrueType

Definition at line 971 of file printer.cpp.

References dcTrueType, and GetCapability().

◆ GetUserAbort()

HDC owl::TPrinter::GetUserAbort ( )
static

Returns the abort DC.

Definition at line 485 of file printer.cpp.

◆ HasDuplexSupport()

auto owl::TPrinter::HasDuplexSupport ( ) const -> bool

Returns whether the printer supports duplex printing.

If the function fails, false is returned.

See also
TCapability::dcDuplex

Definition at line 664 of file printer.cpp.

References dcDuplex, and GetCapability().

◆ IsColorDevice()

auto owl::TPrinter::IsColorDevice ( ) const -> bool

Returns whether the printer supports color printing.

If the function fails, false is returned.

See also
TCapability::dcColorDevice

Definition at line 632 of file printer.cpp.

References dcColorDevice, and GetCapability().

◆ Print()

bool owl::TPrinter::Print ( TWindow * parent,
TPrintout & printout,
bool prompt )
virtual

Print renders the given printout object on the associated printer device and displays an Abort dialog box while printing.

It displays any errors encountered during printing. Prompt allows you to show the user a commdlg print dialog.

Note: The calling sequence here is somewhat of a catch-22 for the printout. The printout cannot compute how many pages the document really has until the page format is known. The printout doesn't get this information until SetPrintParams is called, which cannot happen until the dialog has returned a device context. Unfortunately, the page range information must be provided by GetDialogInfo which has to be called first to set up the dialog.

The problem is that the printer/page options are in the same dialog as the page range selection. The only way to handle this is to implement a custom interactive dialog box that updates the page range in real-time depending on the selected printer/page format. Or deactivate the page range altogether.

Definition at line 1264 of file printer.cpp.

References ClearDevice(), owl::TPrintDialog::TData::Copies, CreateAbortWindow(), owl::TPrintDialog::TData::Error, owl::TXPrinting::Error, ExecPrintDialog(), owl::TPrintDialog::TData::Flags, owl::TPrintDialog::TData::FromPage, owl::TPrintDialog::TData::GetDeviceName(), owl::TPrintDialog::TData::GetDevMode(), owl::TPrintout::GetDialogInfo(), GetPageSize(), owl::TPrintDialog::TData::MaxPage, owl::TPrintDialog::TData::MinPage, PRECONDITION, owl::TXPrinter::Raise(), ReportError(), owl::SetClear(), SetPageSizes(), owl::TPrintout::SetPrintParams(), SetUserAbort(), owl::TPrintDialog::TData::ToPage, owl::TPrinterAbortProc(), owl::TPrintDialog::TData::TransferDC(), and owl::TPrintout::WantBanding().

◆ ReportError()

void owl::TPrinter::ReportError ( TWindow * parent,
TPrintout & printout )
virtual

Reports the current error by bringing up a system message box with an error message composed of the error description and document title.

This function can be overridden to show a custom error dialog box.

Definition at line 1409 of file printer.cpp.

References owl::TWindow::FormatMessageBox(), owl::TXPrinting::GetErrorMessage(), owl::TWindow::GetModule(), owl::TPrintout::GetTitle(), owl::TWindow::LoadString(), and PRECONDITION.

◆ SetData()

void owl::TPrinter::SetData ( TPrintDialog::TData * data)

Sets the common dialog data; takes ownership.

Definition at line 509 of file printer.cpp.

◆ SetDevice()

void owl::TPrinter::SetDevice ( const tstring & device)

Assigns the device to be represented by this TPrinter object.

Definition at line 445 of file printer.cpp.

References _T, and SetData().

◆ SetOutputFile()

void owl::TPrinter::SetOutputFile ( const tstring & outputFile)

Sets the filename for output redirection.

Definition at line 1071 of file printer.cpp.

◆ SetPageSize()

void owl::TPrinter::SetPageSize ( const TSize & pagesize)

Sets the page's size.

Definition at line 527 of file printer.cpp.

◆ SetPageSizeInch()

void owl::TPrinter::SetPageSizeInch ( const TSize & pageSizeInch)

Sets the size of an inch on the page.

Definition at line 543 of file printer.cpp.

◆ SetPageSizes()

void owl::TPrinter::SetPageSizes ( const TPrintDC & dc)
virtual

Updates the PageSize variables by querying the device capabilities of the specified device context.

Definition at line 1081 of file printer.cpp.

◆ Setup()

void owl::TPrinter::Setup ( TWindow * parent)
virtual

Setup lets the user select and/or configure the currently associated printer.

Setup opens a dialog box as a child of the given window. The user then selects one of the buttons in the dialog box to select or configure the printer. The form of the dialog box is based on TPrintDialog, the common dialog printer class. The options button allows the user acces to the specific driver's options.

Definition at line 1398 of file printer.cpp.

References ExecPageSetupDialog().

◆ SetUserAbort()

void owl::TPrinter::SetUserAbort ( HDC abortDC = HDC(-1))
static

Sets the user abort DC for the printer.

Definition at line 477 of file printer.cpp.


The documentation for this class was generated from the following files: