#include "wx/wfstream.h"
+// default font size of normal text (HTML font size 0) for printing, in points:
+#define DEFAULT_PRINT_FONT_SIZE 12
+
+
//--------------------------------------------------------------------------------
// wxHtmlDCRenderer
//--------------------------------------------------------------------------------
m_Parser = new wxHtmlWinParser();
m_FS = new wxFileSystem();
m_Parser->SetFS(m_FS);
+ SetStandardFonts(DEFAULT_PRINT_FONT_SIZE);
}
m_Footers[0] = m_Footers[1] = wxEmptyString;
m_HeaderHeight = m_FooterHeight = 0;
SetMargins(); // to default values
+ SetStandardFonts(DEFAULT_PRINT_FONT_SIZE);
}
bool wxHtmlPrintout::OnPrintPage(int page)
{
wxDC *dc = GetDC();
- if (dc)
+ if (dc && dc->IsOk())
{
if (HasPage(page))
RenderPage(dc, page);
void wxHtmlPrintout::GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo)
{
*minPage = 1;
- if ( m_NumPages >= (signed)m_PageBreaks.Count()-1)
+ if ( m_NumPages >= (signed)m_PageBreaks.GetCount()-1)
*maxPage = m_NumPages;
else
- *maxPage = (signed)m_PageBreaks.Count()-1;
+ *maxPage = (signed)m_PageBreaks.GetCount()-1;
*selPageFrom = 1;
- *selPageTo = (signed)m_PageBreaks.Count()-1;
+ *selPageTo = (signed)m_PageBreaks.GetCount()-1;
}
bool wxHtmlPrintout::HasPage(int pageNum)
{
- return (pageNum >= 1 && pageNum-1 <= (signed)m_PageBreaks.Count());
+ return pageNum > 0 && (unsigned)pageNum < m_PageBreaks.GetCount();
}
m_PageBreaks,
pos, true, INT_MAX);
m_PageBreaks.Add( pos);
- if( m_PageBreaks.Count() > wxHTML_PRINT_MAX_PAGES)
+ if( m_PageBreaks.GetCount() > wxHTML_PRINT_MAX_PAGES)
{
- wxMessageBox( _("HTML pagination algorithm generated more than the allowed maximum number of pages and it can continue any longer!"),
+ wxMessageBox( _("HTML pagination algorithm generated more than the allowed maximum number of pages and it can't continue any longer!"),
_("Warning"), wxCANCEL | wxICON_ERROR );
break;
}
m_Renderer->SetDC(dc, (double)ppiPrinterY / (double)ppiScreenY);
- dc->SetBackgroundMode(wxTRANSPARENT);
+ dc->SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT);
m_Renderer->Render((int) (ppmm_h * m_MarginLeft),
(int) (ppmm_v * (m_MarginTop + (m_HeaderHeight == 0 ? 0 : m_MarginSpace)) + m_HeaderHeight), m_PageBreaks,
num.Printf(wxT("%i"), page);
r.Replace(wxT("@PAGENUM@"), num);
- num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.Count() - 1));
+ num.Printf(wxT("%lu"), (unsigned long)(m_PageBreaks.GetCount() - 1));
r.Replace(wxT("@PAGESCNT@"), num);
const wxDateTime now = wxDateTime::Now();
m_PageSetupData->SetMarginTopLeft(wxPoint(25, 25));
m_PageSetupData->SetMarginBottomRight(wxPoint(25, 25));
- SetFonts(wxEmptyString, wxEmptyString, NULL);
+ SetStandardFonts(DEFAULT_PRINT_FONT_SIZE);
}