• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
KPrinter Class Reference

#include <kprinter.h>

Inherits TQPaintDevice, and KPReloadObject.

Public Types

enum  StandardPageType { CopiesPage = 0x01 , FilesPage = 0x02 , Custom = 0x10 }
 
enum  PageSelectionType { ApplicationSide = 0x01 , SystemSide = 0x02 }
 
enum  ApplicationType { Dialog = 0x00 , StandAlone = 0x01 , StandAlonePersistent = 0x02 }
 
enum  PageSetType { AllPages = 0x00 , OddPages = 0x01 , EvenPages = 0x02 }
 
enum  CollateType { Collate = 0x00 , Uncollate = 0x01 }
 
enum  ColorMode { GrayScale = TQPrinter::GrayScale , Color = TQPrinter::Color }
 
enum  Orientation { Portrait = TQPrinter::Portrait , Landscape = TQPrinter::Landscape }
 
enum  PageOrder { FirstPageFirst = TQPrinter::FirstPageFirst , LastPageFirst = TQPrinter::LastPageFirst }
 
enum  PageSize {
  A4 = TQPrinter::A4 , B5 = TQPrinter::B5 , Letter = TQPrinter::Letter , Legal = TQPrinter::Legal ,
  Executive = TQPrinter::Executive , A0 = TQPrinter::A0 , A1 = TQPrinter::A1 , A2 = TQPrinter::A2 ,
  A3 = TQPrinter::A3 , A5 = TQPrinter::A5 , A6 = TQPrinter::A6 , A7 = TQPrinter::A7 ,
  A8 = TQPrinter::A8 , A9 = TQPrinter::A9 , B0 = TQPrinter::B0 , B1 = TQPrinter::B1 ,
  B10 = TQPrinter::B10 , B2 = TQPrinter::B2 , B3 = TQPrinter::B3 , B4 = TQPrinter::B4 ,
  B6 = TQPrinter::B6 , B7 = TQPrinter::B7 , B8 = TQPrinter::B8 , B9 = TQPrinter::B9 ,
  C5E = TQPrinter::C5E , Comm10E = TQPrinter::Comm10E , DLE = TQPrinter::DLE , Folio = TQPrinter::Folio ,
  Ledger = TQPrinter::Ledger , Tabloid = TQPrinter::Tabloid , NPageSize = TQPrinter::NPageSize
}
 

Public Member Functions

 KPrinter (bool restore=true, TQPrinter::PrinterMode m=TQPrinter::ScreenResolution)
 
 ~KPrinter ()
 
bool newPage ()
 
bool abort ()
 
bool aborted () const
 
bool outputToFile () const
 
void setOutputToFile (bool)
 
TQString outputFileName () const
 
void setOutputFileName (const TQString &)
 
TQString docName () const
 
void setDocName (const TQString &)
 
TQString creator () const
 
void setCreator (const TQString &)
 
bool fullPage () const
 
void setFullPage (bool)
 
ColorMode colorMode () const
 
void setColorMode (ColorMode)
 
int numCopies () const
 
void setNumCopies (int n)
 
Orientation orientation () const
 
void setOrientation (Orientation, bool locking=false)
 
PageOrder pageOrder () const
 
void setPageOrder (PageOrder)
 
CollateType collate () const
 
void setCollate (CollateType type)
 
int minPage () const
 
int maxPage () const
 
void setMinMax (int, int)
 
int fromPage () const TDE_DEPRECATED
 
int toPage () const
 
void setFromTo (int, int)
 
PageSize pageSize () const
 
void setPageSize (PageSize, bool locking=false)
 
TQString printerName () const
 
void setPrinterName (const TQString &)
 
TQString printProgram () const
 
void setPrintProgram (const TQString &cmd)
 
TQString printerSelectionOption () const
 
void setPrinterSelectionOption (const TQString &)
 
int currentPage () const
 
void setCurrentPage (int p=0)
 
PageSetType pageSet () const
 
bool setup (TQWidget *parent=0, const TQString &caption=TQString::null, bool forceExpand=false)
 
TQSize margins () const
 
void setMargins (TQSize m)
 
TQSize realPageSize () const
 
void setRealPageSize (TQSize p)
 
void setRealDrawableArea (const TQRect &r)
 
TQRect realDrawableArea () const
 
void margins (uint *top, uint *left, uint *bottom, uint *right) const
 
void setMargins (uint top, uint left, uint bottom, uint right)
 
TQValueList< int > pageList () const
 
void setPreviewOnly (bool on)
 
bool previewOnly () const
 
void setResolution (int dpi)
 
int resolution () const
 
void setUsePrinterResolution (bool on)
 
KPrinterImpl * implementation () const
 
bool printFiles (const TQStringList &files, bool removeafter=false, bool startviewer=true)
 
const TQString & option (const TQString &key) const
 
void setOption (const TQString &key, const TQString &value)
 
const TQMap< TQString, TQString > & options () const
 
void setOptions (const TQMap< TQString, TQString > &opts)
 
void initOptions (const TQMap< TQString, TQString > &opts)
 
TQString searchName () const
 
void setSearchName (const TQString &n)
 
TQString errorMessage () const
 
void setErrorMessage (const TQString &msg)
 
bool autoConfigure (const TQString &prname=TQString::null, TQWidget *parent=0)
 
void setDocFileName (const TQString &filename)
 
TQString docFileName () const
 
void setDocDirectory (const TQString &dir)
 
TQString docDirectory () const
 

Static Public Member Functions

static void addDialogPage (KPrintDialogPage *_page)
 
static void setPageSelection (PageSelectionType _mode)
 
static PageSelectionType pageSelection ()
 
static void setApplicationType (ApplicationType type)
 
static ApplicationType applicationType ()
 
static void addStandardPage (int p)
 
static void removeStandardPage (int p)
 

Protected Member Functions

virtual bool cmd (int, TQPainter *, TQPDevCmdParam *)
 
virtual int metric (int) const
 
void translateQtOptions ()
 
void loadSettings ()
 
void saveSettings ()
 
void preparePrinting ()
 
void finishPrinting ()
 
void reload ()
 
void init (bool restore=true, TQPrinter::PrinterMode m=TQPrinter::ScreenResolution)
 
bool doPreview (const TQString &file)
 
void setRealPageSize (DrPageSize *p)
 
void setOption (const TQString &key, const TQString &value, bool broadcast)
 

Protected Attributes

KPrinterPrivate * d
 

Friends

class KPrinterWrapper
 
class KPrinterImpl
 

Detailed Description

This class is the main interface to access the TDE print framework.

It allows TDE applications to easily access the print system, through an interface that is compatible with TQPrinter. So that the porting of an existing application should be as easy as replacing any occurrence of TQPrinter by KPrinter. However applications that explicitly used the TQPrintDialog class must be changed to the standard KPrinter way of accessing the print dialog.

Basically, a KDE application will use the KPrinter object as a paint device, and will draw on it using TQPainter. In a standard application, the use of the KPrinter class will look like this:

#include <kprinter.h>
#include <tqpainter.h>
void MyClass::doPrint()
{
KPrinter printer;
// do some printer initialization
printer.setFullPage( true );
// initialize the printer using the print dialog
if ( printer.setup( this ) )
{
// create a painter to paint on the printer object
TQPainter painter;
// start painting
painter.begin( &printer );
<do something>
// stop painting, this will automatically send the print data to the printer
painter.end();
}
}
KPrinter
This class is the main interface to access the TDE print framework.
Definition: kprinter.h:89
KPrinter::setup
bool setup(TQWidget *parent=0, const TQString &caption=TQString::null, bool forceExpand=false)
Sets up the KPrinter object using the print dialog, returns true if the user clicked OK.
Definition: kprinter.cpp:219
KPrinter::setFullPage
void setFullPage(bool)
See TQPrinter::setFullPage().
Definition: kprinter.cpp:812

The KPrinter interface also allows some more advanced possibilities, like the customization of the print dialog to integrate application specific print options. This is done by subclassing KPrintDialogPage and adding the page using addDialogPage().

When compiling an application that uses KPrinter, you must link to -ltdeprint, which when using the standard KDE build framework can be done by adding to _LDADD.

The central interface class to access the TDE print system.

Author
Michael Goffioul
See also
TQPrinter, KPrintDialogPage

Definition at line 88 of file kprinter.h.

Member Enumeration Documentation

◆ ApplicationType

enum KPrinter::ApplicationType

Defines the type of the application, this affects the GUI of the print dialog:

  • Dialog: print dialog used in an application (default)
  • StandAlone: print dialog used as a standalone widget
  • StandAlonePersistent: print dialog used as standalone widget, but persistent (do not use)

Definition at line 126 of file kprinter.h.

◆ CollateType

enum KPrinter::CollateType

Defines the collate property of the printer (if supported by the print system):

  • Collate: copies collated (1-2-3-..., 1-2-3-...)
  • Uncollate: copies uncollated (1-1-..., 2-2-..., 3-3-...)
See also
setCollate(), collate()

Definition at line 145 of file kprinter.h.

◆ ColorMode

enum KPrinter::ColorMode

Defines the color mode of the printer.

See also
TQPrinter::ColorMode

Definition at line 152 of file kprinter.h.

◆ Orientation

enum KPrinter::Orientation

Defines the orientation of the paper.

See also
TQPrinter::Orientation

Definition at line 157 of file kprinter.h.

◆ PageOrder

enum KPrinter::PageOrder

Defines the page order of the print job.

See also
TQPrinter::PageOrder

Definition at line 162 of file kprinter.h.

◆ PageSelectionType

enum KPrinter::PageSelectionType

Defines whether the application can perform page selection itself or not.

Some print systems (like CUPS) can do page selection, in this case the page selection will be enabled in the print dialog, otherwise it will be disabled. However some applications (word processor) can do page selection themselves, then it will be enabled in the print dialog, whatever the print system used. But such an application has to tell tdeprint about its feature:

  • ApplicationSide: the application will do page selection
  • SystemSide: page selection will be left to the print system, if available (default)
See also
setPageSelection(), pageSelection()

Definition at line 116 of file kprinter.h.

◆ PageSetType

enum KPrinter::PageSetType

Defines the page set to print:

  • AllPages: all pages
  • OddPages: only odd pages
  • EvenPages: only even pages
See also
pageSet()

Definition at line 137 of file kprinter.h.

◆ PageSize

enum KPrinter::PageSize

Defines the paper size to use.

See also
TQPrinter::PageSize

Definition at line 167 of file kprinter.h.

◆ StandardPageType

enum KPrinter::StandardPageType

Defines the standard pages available for the print dialog:

  • CopiesPage: page and copies selection (included by default)
  • FilesPage: file selection (only used by kprinter utility)
  • Custom: unused
See also
addStandardPage(), removeStandardPage()

Definition at line 102 of file kprinter.h.

Constructor & Destructor Documentation

◆ KPrinter()

KPrinter::KPrinter ( bool  restore = true,
TQPrinter::PrinterMode  m = TQPrinter::ScreenResolution 
)

Constructor.

This also restores/saves the state from a previous KPrinter object created within the same application run, if restore is true. Setting restore to false may be useful if you want an independent/clean KPrinter object.

Parameters
restoreif true, options will be restored/saved between successive KPrinter objects
mthe mode to establish the KPrinter in (see TQPrinter::PrinterMode)

Definition at line 123 of file kprinter.cpp.

◆ ~KPrinter()

KPrinter::~KPrinter ( )

Destructor.

This also saves the current KPrinter state for future printing.

Definition at line 129 of file kprinter.cpp.

Member Function Documentation

◆ abort()

bool KPrinter::abort ( )

See TQPrinter::abort().

Definition at line 938 of file kprinter.cpp.

◆ aborted()

bool KPrinter::aborted ( ) const

See TQPrinter::aborted(.)

Definition at line 941 of file kprinter.cpp.

◆ addDialogPage()

void KPrinter::addDialogPage ( KPrintDialogPage *  _page)
static

Adds a customized page to the print dialog.

The pages will appear in a tab widget in the bottom half of the dialog, along with the standard "Copies" page. The page must be created and added each time you want open a print dialog with setup(). If you correctly reimplemented KPrintDialogPage::setOptions(), the settings will be restored from call to call, you don't have to worry about state saving/restoration.

Parameters
_pagethe page to add
See also
KPrintDialogPage::setOptions()

Definition at line 250 of file kprinter.cpp.

◆ addStandardPage()

void KPrinter::addStandardPage ( int  p)
static

Adds a standard page to the print dialog.

This is not useful yet as there's only one standard page defines CopiesPage.

Parameters
pthe page identifier
See also
StandardPageType

Definition at line 240 of file kprinter.cpp.

◆ applicationType()

KPrinter::ApplicationType KPrinter::applicationType ( )
static

Returns the application type concerning the print dialog.

For internal use only.

Returns
the type for the current application
See also
setApplicationType()

Definition at line 270 of file kprinter.cpp.

◆ autoConfigure()

bool KPrinter::autoConfigure ( const TQString &  prname = TQString::null,
TQWidget *  parent = 0 
)

Configure the KPrinter object to be used with the printer named prname.

After the call, the KPrinter object can be used without the need to call the print dialog. If prname is empty, then the KPrinter object is configured for the default printer. If prname corresponds to a pseudo-printer which needs an output file, a file dialog will be used. In that case, providing a parent widget for that dialog in parent may be useful.

Parameters
prnamethe name of the printer for which the KPrinter object has to be configured
parenta parent widget, used a parent for a file dialog
Returns
boolean flag: if false, the KPrinter has not been correctly set up, and the application shouldn't use it to print. This may happen if the printer named prname has not been found or if the user clicked "Cancel" in the file dialog.
See also
setup()

Definition at line 673 of file kprinter.cpp.

◆ cmd()

bool KPrinter::cmd ( int  c,
TQPainter *  painter,
TQPDevCmdParam *  p 
)
protectedvirtual

Definition at line 275 of file kprinter.cpp.

◆ collate()

KPrinter::CollateType KPrinter::collate ( ) const

Returns the collate status of the current KPrinter.

Definition at line 833 of file kprinter.cpp.

◆ colorMode()

KPrinter::ColorMode KPrinter::colorMode ( ) const

See TQPrinter::colorMode().

Definition at line 815 of file kprinter.cpp.

◆ creator()

TQString KPrinter::creator ( ) const

See TQPrinter::creator().

Definition at line 803 of file kprinter.cpp.

◆ currentPage()

int KPrinter::currentPage ( ) const

Returns the current page number.

See also
setCurrentPage()

Definition at line 864 of file kprinter.cpp.

◆ docDirectory()

TQString KPrinter::docDirectory ( ) const

Get the default document directory, that is the directory used for any output file.

By default, it is the $HOME directory.

Returns
the default output directory
See also
setDocDirectory

Definition at line 1038 of file kprinter.cpp.

◆ docFileName()

TQString KPrinter::docFileName ( ) const

Get the default document filename, that is the default basename used for the output file.

Returns
the default document basename
See also
setDocFileName()

Definition at line 1032 of file kprinter.cpp.

◆ docName()

TQString KPrinter::docName ( ) const

See TQPrinter::docName().

Definition at line 797 of file kprinter.cpp.

◆ doPreview()

bool KPrinter::doPreview ( const TQString &  file)
protected

Definition at line 427 of file kprinter.cpp.

◆ errorMessage()

TQString KPrinter::errorMessage ( ) const

Returns the last error message issued by the print system.

Unimplemented yet.

Returns
the last error message

Definition at line 1013 of file kprinter.cpp.

◆ finishPrinting()

void KPrinter::finishPrinting ( )
protected

Definition at line 463 of file kprinter.cpp.

◆ fromPage()

int KPrinter::fromPage ( ) const

Returns the first page to be printed.

Deprecated:
Applications should use pageList() instead, which takes into account all options: collate, page order, ranges, page set, ...
See also
pageList()

Definition at line 848 of file kprinter.cpp.

◆ fullPage()

bool KPrinter::fullPage ( ) const

See TQPrinter::fullPage().

Definition at line 809 of file kprinter.cpp.

◆ implementation()

KPrinterImpl * KPrinter::implementation ( ) const

For internal use only.

Definition at line 788 of file kprinter.cpp.

◆ init()

void KPrinter::init ( bool  restore = true,
TQPrinter::PrinterMode  m = TQPrinter::ScreenResolution 
)
protected

Definition at line 143 of file kprinter.cpp.

◆ initOptions()

void KPrinter::initOptions ( const TQMap< TQString, TQString > &  opts)

For internal use only.

Does a similar job as setOption(), except that all possible internal printers are initialized with the option if it has the form "kde-...".

Parameters
optsthe option set
See also
setOptions()

Definition at line 651 of file kprinter.cpp.

◆ loadSettings()

void KPrinter::loadSettings ( )
protected

Definition at line 167 of file kprinter.cpp.

◆ margins() [1/2]

TQSize KPrinter::margins ( ) const

See TQPrinter::margins().

Definition at line 550 of file kprinter.cpp.

◆ margins() [2/2]

void KPrinter::margins ( uint *  top,
uint *  left,
uint *  bottom,
uint *  right 
) const

Definition at line 555 of file kprinter.cpp.

◆ maxPage()

int KPrinter::maxPage ( ) const

See TQPrinter::maxPage().

Definition at line 842 of file kprinter.cpp.

◆ metric()

int KPrinter::metric ( int  m) const
protectedvirtual

Definition at line 560 of file kprinter.cpp.

◆ minPage()

int KPrinter::minPage ( ) const

See TQPrinter::minPage().

Definition at line 839 of file kprinter.cpp.

◆ newPage()

bool KPrinter::newPage ( )

See TQPrinter::newPage().

Definition at line 912 of file kprinter.cpp.

◆ numCopies()

int KPrinter::numCopies ( ) const

See TQPrinter::numCopies().

Definition at line 543 of file kprinter.cpp.

◆ option()

const TQString & KPrinter::option ( const TQString &  key) const

Starts the add printer wizard.

This utility function allows any application for adding a printer using the TDEPrint powerful wizard.

Parameters
parentthe parent widget for the wizard
Returns
1: success, 0: cancel, -1: error The KPrinter object stores all its settings in an internal TQMap structure on TQString. This allows to store any property. This method allows an application to access any print option from the KPrinter object, using the option name. For example if your application add a customized page to the print dialog, this page will saves its settings into the KPrinter object using this TQMap<TQString,TQString> structure. After showing the print dialog, your application can then access these options using this method. The custom option name should follow the form "kde-appname-optionname".
void MyClass::doPrint()
{
KPrinter prt;
// add my custom page
prt.addDialogPage( new MyDialogPage() );
// open print dialog
if ( prt.setup( this ) )
{
TQString fntname = prt.option( "kde-myapp-fontname" );
...
do_something;
...
}
}
KPrinter::option
const TQString & option(const TQString &key) const
Starts the add printer wizard.
Definition: kprinter.cpp:791
KPrinter::addDialogPage
static void addDialogPage(KPrintDialogPage *_page)
Adds a customized page to the print dialog.
Definition: kprinter.cpp:250
Parameters
keythe option name (key)
Returns
the option value correponding to the key, or TQString::null
See also
KPrintDialogPage, setOption, options(), setOptions()

Definition at line 791 of file kprinter.cpp.

◆ options()

const TQMap< TQString, TQString > & KPrinter::options ( ) const

Returns the complete set of print options from the KPrinter object.

For internal use.

Returns
the option set as a TQMap object

Definition at line 903 of file kprinter.cpp.

◆ orientation()

KPrinter::Orientation KPrinter::orientation ( ) const

See TQPrinter::orientation().

Definition at line 824 of file kprinter.cpp.

◆ outputFileName()

TQString KPrinter::outputFileName ( ) const

See TQPrinter::outputFileName().

Definition at line 919 of file kprinter.cpp.

◆ outputToFile()

bool KPrinter::outputToFile ( ) const

See TQPrinter::outputToFile().

Definition at line 925 of file kprinter.cpp.

◆ pageList()

TQValueList< int > KPrinter::pageList ( ) const

Returns the page list to be printed, correpsonding to the options selected by the user.

This takes into account collate, page order, page set, ranges, ... This is useful when the application does page selection itself.

See also
setCurrentPage()

Definition at line 470 of file kprinter.cpp.

◆ pageOrder()

KPrinter::PageOrder KPrinter::pageOrder ( ) const

See TQPrinter::pageOrder().

Definition at line 827 of file kprinter.cpp.

◆ pageSelection()

KPrinter::PageSelectionType KPrinter::pageSelection ( )
static

Returns the page selection mode of the current application.

Returns
the page selection mode
See also
setPageSelection()

Definition at line 260 of file kprinter.cpp.

◆ pageSet()

KPrinter::PageSetType KPrinter::pageSet ( ) const

Returns the page set of the current KPrinter object.

Definition at line 861 of file kprinter.cpp.

◆ pageSize()

KPrinter::PageSize KPrinter::pageSize ( ) const

See TQPrinter::pageSize().

Definition at line 858 of file kprinter.cpp.

◆ preparePrinting()

void KPrinter::preparePrinting ( )
protected

Definition at line 434 of file kprinter.cpp.

◆ previewOnly()

bool KPrinter::previewOnly ( ) const

Returns the preview-only state for this KPrinter object.

See also
setPreviewOnly()

Definition at line 1026 of file kprinter.cpp.

◆ printerName()

TQString KPrinter::printerName ( ) const

See TQPrinter::printerName().

Definition at line 870 of file kprinter.cpp.

◆ printerSelectionOption()

TQString KPrinter::printerSelectionOption ( ) const

See TQPrinter::printerSelectionOption().

Unused.

Definition at line 897 of file kprinter.cpp.

◆ printFiles()

bool KPrinter::printFiles ( const TQStringList &  files,
bool  removeafter = false,
bool  startviewer = true 
)

Prints the files given in argument.

This will first filter the files accorsing to the filtering options selected by the user in the print dialog, then send the filtered files to the printer with the print options selected. This function is called automatically when calling TQPainter::end() for a painter object constructed on KPrinter. In normal use, you don't need this use this function explicitly.

Definition at line 358 of file kprinter.cpp.

◆ printProgram()

TQString KPrinter::printProgram ( ) const

Returns the print program as set by setPrintProgram() or by the print dialog if a special printer has been selected.

Returns
the print command line
See also
setPrintProgram()

Definition at line 876 of file kprinter.cpp.

◆ realDrawableArea()

TQRect KPrinter::realDrawableArea ( ) const

DO NOT USE, WILL BE REMOVED.

Deprecated:

Definition at line 1004 of file kprinter.cpp.

◆ realPageSize()

TQSize KPrinter::realPageSize ( ) const

Returns the page size in dot unit ( 1 dot = 1/72th in ).

This method is intended for internal use, if you want to access actual page size, use a TQPaintDeviceMetrics object instead. Note that the size returned by this method does not take resolution into account, and that it can returns invalid size if no page metric was found in the printer driver. DO NOT USE, WILL BE REMOVED.

See also
setRealPageSize
Deprecated:

Definition at line 959 of file kprinter.cpp.

◆ reload()

void KPrinter::reload ( )
protected

Definition at line 663 of file kprinter.cpp.

◆ removeStandardPage()

void KPrinter::removeStandardPage ( int  p)
static

Removes a standard page from the print dialog.

If your application doesn't want a standard page in the dialog, simply call this method with the correct identifier. By default, the print dialog includes the CopiesPage page.

Parameters
pthe page identifier
See also
StandardPageType

Definition at line 245 of file kprinter.cpp.

◆ resolution()

int KPrinter::resolution ( ) const

Resturns the resolution of the current KPrinter object.

The resolution is given in DPI.

Returns
resolution in DPI
See also
setResolution(), KPrinter()

Definition at line 1047 of file kprinter.cpp.

◆ saveSettings()

void KPrinter::saveSettings ( )
protected

Definition at line 193 of file kprinter.cpp.

◆ searchName()

TQString KPrinter::searchName ( ) const

Returns the search name of the printer selected by the user.

Each printer is identified by a unique name. This method is mainly used for state restoration. For internal use.

Returns
the unique printer search name
See also
setSearchName

Definition at line 906 of file kprinter.cpp.

◆ setApplicationType()

void KPrinter::setApplicationType ( ApplicationType  type)
static

Sets the application type concerning the print dialog.

You probably don't want to use it. For internal use only.

Parameters
typethe type for this application
See also
applicationType()

Definition at line 265 of file kprinter.cpp.

◆ setCollate()

void KPrinter::setCollate ( CollateType  type)

Sets the collate status for the current KPrinter to type.

Definition at line 836 of file kprinter.cpp.

◆ setColorMode()

void KPrinter::setColorMode ( ColorMode  m)

See TQPrinter::setColorMode().

Definition at line 818 of file kprinter.cpp.

◆ setCreator()

void KPrinter::setCreator ( const TQString &  d)

See TQPrinter::setCreator().

Definition at line 806 of file kprinter.cpp.

◆ setCurrentPage()

void KPrinter::setCurrentPage ( int  p = 0)

Sets the current page number.

This page number will be used if the user selected "current page" in the print dialog. This option will only be enabled if the application does page selection itself and the application has called setCurrentPage() before opening the print dialog:

MyClass::MyClass()
{
// declares my application able to do page selection
KPrinter::setPageSelection( KPrinter::ApplicationSide );
}
void MyClass::doPrint()
{
KPrinter printer;
printer.setCurrentPage( mycurrentpage );
if ( printer.setup( this ) )
{
TQValueList<int> pages = printer.pageList();
// print the pages
...
}
}
KPrinter::pageList
TQValueList< int > pageList() const
Returns the page list to be printed, correpsonding to the options selected by the user.
Definition: kprinter.cpp:470
KPrinter::setCurrentPage
void setCurrentPage(int p=0)
Sets the current page number.
Definition: kprinter.cpp:867
KPrinter::setPageSelection
static void setPageSelection(PageSelectionType _mode)
Sets the page selection mode of the application.
Definition: kprinter.cpp:255
Parameters
pthe current page number (starting from 1)

Definition at line 867 of file kprinter.cpp.

◆ setDocDirectory()

void KPrinter::setDocDirectory ( const TQString &  dir)

Set the default document directory.

This directory will be used as the default location for any output file. If not set, $HOME directory is used instead.

Parameters
dirthe new default output directory
See also
docDirectory()

Definition at line 1035 of file kprinter.cpp.

◆ setDocFileName()

void KPrinter::setDocFileName ( const TQString &  filename)

Set the default document filename.

This filename will be used as the default basename for the output file, instead of the default "print". For example, by using setDocFileName("my_document"), the default output file will be $HOME/my_document.ps.

Parameters
filenamethe default document basename to use
See also
docFileName()

Definition at line 1029 of file kprinter.cpp.

◆ setDocName()

void KPrinter::setDocName ( const TQString &  d)

See TQPrinter::setDocName().

Definition at line 800 of file kprinter.cpp.

◆ setErrorMessage()

void KPrinter::setErrorMessage ( const TQString &  msg)

Sets the last error message.

For internal use.

Parameters
msgthe error message

Definition at line 1016 of file kprinter.cpp.

◆ setFromTo()

void KPrinter::setFromTo ( int  m,
int  M 
)

Sets the first and last page to be printed.

See TQPrinter::setFromTo().

Definition at line 854 of file kprinter.cpp.

◆ setFullPage()

void KPrinter::setFullPage ( bool  on)

See TQPrinter::setFullPage().

Definition at line 812 of file kprinter.cpp.

◆ setMargins() [1/2]

void KPrinter::setMargins ( TQSize  m)

Not used yet.

Definition at line 944 of file kprinter.cpp.

◆ setMargins() [2/2]

void KPrinter::setMargins ( uint  top,
uint  left,
uint  bottom,
uint  right 
)

Definition at line 949 of file kprinter.cpp.

◆ setMinMax()

void KPrinter::setMinMax ( int  m,
int  M 
)

See TQPrinter::setMinMax().

Definition at line 845 of file kprinter.cpp.

◆ setNumCopies()

void KPrinter::setNumCopies ( int  n)

See TQPrinter::setNumCopies().

Definition at line 821 of file kprinter.cpp.

◆ setOption() [1/2]

void KPrinter::setOption ( const TQString &  key,
const TQString &  value 
)

Adds or modifies an option in the KPrinter object.

You probably don't need to use this function explicitly. This will be done implicitely for example when reimplementing KPrintDialogPage::getOptions().

Parameters
keythe option name
valuethe option value
See also
option(), KPrintDialogPage

Definition at line 794 of file kprinter.cpp.

◆ setOption() [2/2]

void KPrinter::setOption ( const TQString &  key,
const TQString &  value,
bool  broadcast 
)
protected

Definition at line 611 of file kprinter.cpp.

◆ setOptions()

void KPrinter::setOptions ( const TQMap< TQString, TQString > &  opts)

Sets the option set in one operation.

This method has some side effects like merging the internal map with the one given in argument, but only for option in the form "kde-...". For internal use only.

Parameters
optsthe option set to be merged in the KPrinter object

Definition at line 628 of file kprinter.cpp.

◆ setOrientation()

void KPrinter::setOrientation ( Orientation  o,
bool  locking = false 
)

See TQPrinter::setOrientation().

Definition at line 600 of file kprinter.cpp.

◆ setOutputFileName()

void KPrinter::setOutputFileName ( const TQString &  f)

See TQPrinter::setOutputFileName().

Definition at line 922 of file kprinter.cpp.

◆ setOutputToFile()

void KPrinter::setOutputToFile ( bool  on)

See TQPrinter::setOutputToFile().

Definition at line 928 of file kprinter.cpp.

◆ setPageOrder()

void KPrinter::setPageOrder ( PageOrder  o)

See TQPrinter::setPageOrder().

Definition at line 830 of file kprinter.cpp.

◆ setPageSelection()

void KPrinter::setPageSelection ( PageSelectionType  _mode)
static

Sets the page selection mode of the application.

If needed, call this method somewhere at the beginning of your code. The default value is SystemSide.

Parameters
_modethe mode for the application
See also
pageSelection()

Definition at line 255 of file kprinter.cpp.

◆ setPageSize()

void KPrinter::setPageSize ( PageSize  s,
bool  locking = false 
)

See TQPrinter::setPageSize().

Definition at line 618 of file kprinter.cpp.

◆ setPreviewOnly()

void KPrinter::setPreviewOnly ( bool  on)

Sets the KPrinter object to preview mode if on is true.

In this mode, nothing will be printed but only a preview dialog will be popped up with the single "Close" action. Using this mode, any application can easily implement a preview action:

void MyClass:doPreview()
{
// use a "clean" KPrinter object (independent from previous print jobs),
// this is not necessary, it depends on the application
KPrinter prt( false );
prt.setPreviewOnly( true );
TQPainter painter( &prt );
doPrint( &painter );
}
Parameters
onthe preview-only state
See also
previewOnly()

Definition at line 1023 of file kprinter.cpp.

◆ setPrinterName()

void KPrinter::setPrinterName ( const TQString &  s)

See TQPrinter::setPrinterName().

Definition at line 873 of file kprinter.cpp.

◆ setPrinterSelectionOption()

void KPrinter::setPrinterSelectionOption ( const TQString &  )

See TQPrinter::setPrinterSelectionOption().

Unused

Definition at line 900 of file kprinter.cpp.

◆ setPrintProgram()

void KPrinter::setPrintProgram ( const TQString &  cmd)

Sets the command line to use when printing.

This function is useful when using a KPrinter object without the print dialog, to control what to print and how to do it. The command line may contain the following tags:

  • in : the input file to the print program. It is required and automatically appended at the end of the command line if not present.
  • out : the output file. Use this tag in conjunction with setOutputToFile() and setOutputFileName()
  • psl : the page size in lower case. This may be useful with some programs like gs.
    void createPNGOutputFile(const TQString& filename)
    {
    // use a clean KPrinter object
    KPrinter prt(false);
    prt.setOutputToFile( true );
    prt.setOutputFileName( filename );
    prt.setPrintProgram( "gs -sDEVICE=png256 -sPAPERSIZE=%psl -sOutputFile=%out %in" );
    TQPainter painter( &prt );
    doPaint( &painter );
    }
    Parameters
    cmdthe print command line (containing at least the in tag)
    See also
    printProgram()

Definition at line 879 of file kprinter.cpp.

◆ setRealDrawableArea()

void KPrinter::setRealDrawableArea ( const TQRect &  r)

DO NOT USE, WILL BE REMOVED.

Deprecated:

Definition at line 998 of file kprinter.cpp.

◆ setRealPageSize() [1/2]

void KPrinter::setRealPageSize ( DrPageSize *  p)
protected

Definition at line 968 of file kprinter.cpp.

◆ setRealPageSize() [2/2]

void KPrinter::setRealPageSize ( TQSize  p)

DO NOT USE, WILL BE REMOVED.

Deprecated:

Definition at line 992 of file kprinter.cpp.

◆ setResolution()

void KPrinter::setResolution ( int  dpi)

Set the resolution of the current KPrinter object.

The resolution is given in DPI. This resolution mainly affects the accuracy for object positionning on the paint device, and does not influence the real resolution that will be used by the printer (this should be set in the driver settings). The resolution is usually defined in the constructor.

Parameters
dpithe resolution in DPI
See also
KPrinter(), resolution()

Definition at line 1041 of file kprinter.cpp.

◆ setSearchName()

void KPrinter::setSearchName ( const TQString &  n)

Sets the search name of the KPrinter object.

For internal use.

Parameters
nthe unique printer search name
See also
searchName()

Definition at line 909 of file kprinter.cpp.

◆ setup()

bool KPrinter::setup ( TQWidget *  parent = 0,
const TQString &  caption = TQString::null,
bool  forceExpand = false 
)

Sets up the KPrinter object using the print dialog, returns true if the user clicked OK.

Parameters
parentthe parent widget to use for the print dialog
captionthe caption to use in the print dialog
forceExpandforce the expansion of the dialog (the show/hide button will be hidden)
Returns
boolean value corresponding to the button clicked by the user

Definition at line 219 of file kprinter.cpp.

◆ setUsePrinterResolution()

void KPrinter::setUsePrinterResolution ( bool  on)

Define the KPrinter object to use the actual printer resolution.

Under some print systems (CUPS, Foomatic, PostScript printers), it is possible to know the actual resolution that is used by the printer, as selected by the user in the driver settings. If on is true, this KPrinter object will use the actual printer resolution if it is able to extract it. If nothing can be found, the default resolution will be the one defined by the PrinterMode argument used in the KPrinter constructor, or set explicitly by setResolution().

Parameters
ontrue if the KPrinter object should use the actual printer resolution
See also
resolution(), setResolution()

Definition at line 1050 of file kprinter.cpp.

◆ toPage()

int KPrinter::toPage ( ) const

Returns the last page to be printed.

Deprecated:
Applications should use pageList() instead, which takes into account all options: collate, page order, ranges, page set, ...
See also
pageList()

Definition at line 851 of file kprinter.cpp.

◆ translateQtOptions()

void KPrinter::translateQtOptions ( )
protected

Scale margings as the margin widget always stores values in dot units ( 1/72th in ), to be resolution independent when specified by the user ( who usually specifies margins in metric units ).

Definition at line 296 of file kprinter.cpp.

Friends And Related Function Documentation

◆ KPrinterImpl

friend class KPrinterImpl
friend

Definition at line 91 of file kprinter.h.

◆ KPrinterWrapper

friend class KPrinterWrapper
friend

Definition at line 90 of file kprinter.h.

Member Data Documentation

◆ d

KPrinterPrivate* KPrinter::d
protected

Definition at line 765 of file kprinter.h.


The documentation for this class was generated from the following files:
  • kprinter.h
  • kprinter.cpp

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.9.4
This website is maintained by Timothy Pearson.