Version: 3.0.3

#include <wx/html/htmprint.h>

+ Inheritance diagram for wxHtmlPrintout:

Detailed Description

This class serves as printout class for HTML documents.

Library:  wxHTML
Category:  HTML, Printing Framework

Public Member Functions

 wxHtmlPrintout (const wxString &title="Printout")
 Constructor. More...
 
void SetFonts (const wxString &normal_face, const wxString &fixed_face, const int *sizes=NULL)
 This function sets font sizes and faces. More...
 
void SetFooter (const wxString &footer, int pg=wxPAGE_ALL)
 Set page footer. More...
 
void SetHeader (const wxString &header, int pg=wxPAGE_ALL)
 Set page header. More...
 
void SetHtmlFile (const wxString &htmlfile)
 Prepare the class for printing this HTML file. More...
 
void SetHtmlText (const wxString &html, const wxString &basepath=wxEmptyString, bool isdir=true)
 Prepare the class for printing this HTML text. More...
 
void SetMargins (float top=25.2, float bottom=25.2, float left=25.2, float right=25.2, float spaces=5)
 Sets margins in millimeters. More...
 
- Public Member Functions inherited from wxPrintout
 wxPrintout (const wxString &title="Printout")
 Constructor. More...
 
virtual ~wxPrintout ()
 Destructor. More...
 
void FitThisSizeToPage (const wxSize &imageSize)
 Set the user scale and device origin of the wxDC associated with this wxPrintout so that the given image size fits entirely within the page rectangle and the origin is at the top left corner of the page rectangle. More...
 
void FitThisSizeToPageMargins (const wxSize &imageSize, const wxPageSetupDialogData &pageSetupData)
 Set the user scale and device origin of the wxDC associated with this wxPrintout so that the given image size fits entirely within the page margins set in the given wxPageSetupDialogData object. More...
 
void FitThisSizeToPaper (const wxSize &imageSize)
 Set the user scale and device origin of the wxDC associated with this wxPrintout so that the given image size fits entirely within the paper and the origin is at the top left corner of the paper. More...
 
wxDCGetDC () const
 Returns the device context associated with the printout (given to the printout at start of printing or previewing). More...
 
wxRect GetLogicalPageMarginsRect (const wxPageSetupDialogData &pageSetupData) const
 Return the rectangle corresponding to the page margins specified by the given wxPageSetupDialogData object in the associated wxDC's logical coordinates for the current user scale and device origin. More...
 
wxRect GetLogicalPageRect () const
 Return the rectangle corresponding to the page in the associated wxDC 's logical coordinates for the current user scale and device origin. More...
 
wxRect GetLogicalPaperRect () const
 Return the rectangle corresponding to the paper in the associated wxDC 's logical coordinates for the current user scale and device origin. More...
 
void GetPPIPrinter (int *w, int *h) const
 Returns the number of pixels per logical inch of the printer device context. More...
 
void GetPPIScreen (int *w, int *h) const
 Returns the number of pixels per logical inch of the screen device context. More...
 
virtual void GetPageInfo (int *minPage, int *maxPage, int *pageFrom, int *pageTo)
 Called by the framework to obtain information from the application about minimum and maximum page values that the user can select, and the required page range to be printed. More...
 
void GetPageSizeMM (int *w, int *h) const
 Returns the size of the printer page in millimetres. More...
 
void GetPageSizePixels (int *w, int *h) const
 Returns the size of the printer page in pixels, called the page rectangle. More...
 
wxRect GetPaperRectPixels () const
 Returns the rectangle that corresponds to the entire paper in pixels, called the paper rectangle. More...
 
virtual wxString GetTitle () const
 Returns the title of the printout. More...
 
virtual bool HasPage (int pageNum)
 Should be overridden to return true if the document has this page, or false if not. More...
 
virtual bool IsPreview () const
 Returns true if the printout is currently being used for previewing. More...
 
wxPrintPreviewGetPreview () const
 Returns the associated preview object if any. More...
 
void MapScreenSizeToDevice ()
 Set the user scale and device origin of the wxDC associated with this wxPrintout so that one screen pixel maps to one device pixel on the DC. More...
 
void MapScreenSizeToPage ()
 This sets the user scale of the wxDC associated with this wxPrintout to the same scale as MapScreenSizeToPaper() but sets the logical origin to the top left corner of the page rectangle. More...
 
void MapScreenSizeToPageMargins (const wxPageSetupDialogData &pageSetupData)
 This sets the user scale of the wxDC associated with this wxPrintout to the same scale as MapScreenSizeToPageMargins() but sets the logical origin to the top left corner of the page margins specified by the given wxPageSetupDialogData object. More...
 
void MapScreenSizeToPaper ()
 Set the user scale and device origin of the wxDC associated with this wxPrintout so that the printed page matches the screen size as closely as possible and the logical origin is in the top left corner of the paper rectangle. More...
 
void OffsetLogicalOrigin (wxCoord xoff, wxCoord yoff)
 Shift the device origin by an amount specified in logical coordinates. More...
 
virtual bool OnBeginDocument (int startPage, int endPage)
 Called by the framework at the start of document printing. More...
 
virtual void OnBeginPrinting ()
 Called by the framework at the start of printing. More...
 
virtual void OnEndDocument ()
 Called by the framework at the end of document printing. More...
 
virtual void OnEndPrinting ()
 Called by the framework at the end of printing. More...
 
virtual void OnPreparePrinting ()
 Called once by the framework before any other demands are made of the wxPrintout object. More...
 
virtual bool OnPrintPage (int pageNum)=0
 Called by the framework when a page should be printed. More...
 
void SetLogicalOrigin (wxCoord x, wxCoord y)
 Set the device origin of the associated wxDC so that the current logical point becomes the new logical origin. More...
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data. More...
 
 wxObject (const wxObject &other)
 Copy ctor. More...
 
virtual ~wxObject ()
 Destructor. More...
 
virtual wxClassInfoGetClassInfo () const
 This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). More...
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class. More...
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj. More...
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone. More...
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer. More...
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public. More...
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
 
void * operator new (size_t size, const wxString &filename=NULL, int lineNum=0)
 The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. More...
 

Static Public Member Functions

static void AddFilter (wxHtmlFilter *filter)
 Adds a filter to the static list of filters for wxHtmlPrintout. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wxObject
void AllocExclusive ()
 Ensure that this object's data is not shared with any other object. More...
 
virtual wxObjectRefDataCreateRefData () const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
 
virtual wxObjectRefDataCloneRefData (const wxObjectRefData *data) const
 Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. More...
 
- Protected Attributes inherited from wxObject
wxObjectRefDatam_refData
 Pointer to an object which is the object's reference-counted data. More...
 

Constructor & Destructor Documentation

wxHtmlPrintout::wxHtmlPrintout ( const wxString title = "Printout")

Constructor.

Member Function Documentation

static void wxHtmlPrintout::AddFilter ( wxHtmlFilter filter)
static

Adds a filter to the static list of filters for wxHtmlPrintout.

See wxHtmlFilter for further information.

void wxHtmlPrintout::SetFonts ( const wxString normal_face,
const wxString fixed_face,
const int *  sizes = NULL 
)

This function sets font sizes and faces.

See wxHtmlWindow::SetFonts for detailed description.

void wxHtmlPrintout::SetFooter ( const wxString footer,
int  pg = wxPAGE_ALL 
)

Set page footer.

The following macros can be used inside it:

  • @DATE@ is replaced by the current date in default format
  • @PAGENUM@ is replaced by page number
  • @PAGESCNT@ is replaced by total number of pages
  • @TIME@ is replaced by the current time in default format
  • @TITLE@ is replaced with the title of the document
Parameters
footerHTML text to be used as footer.
pgone of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
void wxHtmlPrintout::SetHeader ( const wxString header,
int  pg = wxPAGE_ALL 
)

Set page header.

The following macros can be used inside it:

  • @DATE@ is replaced by the current date in default format
  • @PAGENUM@ is replaced by page number
  • @PAGESCNT@ is replaced by total number of pages
  • @TIME@ is replaced by the current time in default format
  • @TITLE@ is replaced with the title of the document
Parameters
headerHTML text to be used as header.
pgone of wxPAGE_ODD, wxPAGE_EVEN and wxPAGE_ALL constants.
void wxHtmlPrintout::SetHtmlFile ( const wxString htmlfile)

Prepare the class for printing this HTML file.

The file may be located on any virtual file system or it may be normal file.

void wxHtmlPrintout::SetHtmlText ( const wxString html,
const wxString basepath = wxEmptyString,
bool  isdir = true 
)

Prepare the class for printing this HTML text.

Parameters
htmlHTML text. (NOT file!)
basepathbase directory (html string would be stored there if it was in file). It is used to determine path for loading images, for example.
isdirfalse if basepath is filename, true if it is directory name (see wxFileSystem for detailed explanation).
void wxHtmlPrintout::SetMargins ( float  top = 25.2,
float  bottom = 25.2,
float  left = 25.2,
float  right = 25.2,
float  spaces = 5 
)

Sets margins in millimeters.

Defaults to 1 inch for margins and 0.5cm for space between text and header and/or footer.