Version: 3.0.2
wxHtmlPrintout Class Reference

#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.
 
void SetFonts (const wxString &normal_face, const wxString &fixed_face, const int *sizes=NULL)
 This function sets font sizes and faces.
 
void SetFooter (const wxString &footer, int pg=wxPAGE_ALL)
 Set page footer.
 
void SetHeader (const wxString &header, int pg=wxPAGE_ALL)
 Set page header.
 
void SetHtmlFile (const wxString &htmlfile)
 Prepare the class for printing this HTML file.
 
void SetHtmlText (const wxString &html, const wxString &basepath=wxEmptyString, bool isdir=true)
 Prepare the class for printing this HTML text.
 
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.
 
- Public Member Functions inherited from wxPrintout
 wxPrintout (const wxString &title="Printout")
 Constructor.
 
virtual ~wxPrintout ()
 Destructor.
 
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.
 
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.
 
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.
 
wxDCGetDC () const
 Returns the device context associated with the printout (given to the printout at start of printing or previewing).
 
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.
 
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.
 
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.
 
void GetPPIPrinter (int *w, int *h) const
 Returns the number of pixels per logical inch of the printer device context.
 
void GetPPIScreen (int *w, int *h) const
 Returns the number of pixels per logical inch of the screen device context.
 
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.
 
void GetPageSizeMM (int *w, int *h) const
 Returns the size of the printer page in millimetres.
 
void GetPageSizePixels (int *w, int *h) const
 Returns the size of the printer page in pixels, called the page rectangle.
 
wxRect GetPaperRectPixels () const
 Returns the rectangle that corresponds to the entire paper in pixels, called the paper rectangle.
 
virtual wxString GetTitle () const
 Returns the title of the printout.
 
virtual bool HasPage (int pageNum)
 Should be overridden to return true if the document has this page, or false if not.
 
virtual bool IsPreview () const
 Returns true if the printout is currently being used for previewing.
 
wxPrintPreviewGetPreview () const
 Returns the associated preview object if any.
 
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.
 
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.
 
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.
 
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.
 
void OffsetLogicalOrigin (wxCoord xoff, wxCoord yoff)
 Shift the device origin by an amount specified in logical coordinates.
 
virtual bool OnBeginDocument (int startPage, int endPage)
 Called by the framework at the start of document printing.
 
virtual void OnBeginPrinting ()
 Called by the framework at the start of printing.
 
virtual void OnEndDocument ()
 Called by the framework at the end of document printing.
 
virtual void OnEndPrinting ()
 Called by the framework at the end of printing.
 
virtual void OnPreparePrinting ()
 Called once by the framework before any other demands are made of the wxPrintout object.
 
virtual bool OnPrintPage (int pageNum)=0
 Called by the framework when a page should be printed.
 
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.
 
- Public Member Functions inherited from wxObject
 wxObject ()
 Default ctor; initializes to NULL the internal reference data.
 
 wxObject (const wxObject &other)
 Copy ctor.
 
virtual ~wxObject ()
 Destructor.
 
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).
 
wxObjectRefDataGetRefData () const
 Returns the wxObject::m_refData pointer, i.e. the data referenced by this object.
 
bool IsKindOf (const wxClassInfo *info) const
 Determines whether this class is a subclass of (or the same class as) the given class.
 
bool IsSameAs (const wxObject &obj) const
 Returns true if this object has the same data pointer as obj.
 
void Ref (const wxObject &clone)
 Makes this object refer to the data in clone.
 
void SetRefData (wxObjectRefData *data)
 Sets the wxObject::m_refData pointer.
 
void UnRef ()
 Decrements the reference count in the associated data, and if it is zero, deletes the data.
 
void UnShare ()
 This is the same of AllocExclusive() but this method is public.
 
void operator delete (void *buf)
 The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined.
 
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.
 

Static Public Member Functions

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

Additional Inherited Members

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

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.