Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

void wxPdfDocument::AddPage ( int  orientation = -1 ) [virtual]

Adds a new page to the document.

If a page is already present, the Footer() method is called first to output the footer. Then the page is added, the current position set to the top-left corner according to the left and top margins, and Header() is called to display the header. The font which was set before calling is automatically restored. There is no need to call SetFont() again if you want to continue with the same font. The same is true for colors and line width. The origin of the coordinate system is at the top-left corner and increasing ordinates go downwards.

Parameters:
orientationPage orientation. Possible values are:

  • wxPORTRAIT
  • wxLANDSCAPE The default value is the one passed to the constructor.
See also:
FPDF(), Header(), Footer(), SetMargins()

Definition at line 457 of file pdfdoc.cpp.

References BeginPage(), Double2String(), EndPage(), Footer(), wxPdfColour::GetColor(), Header(), m_colorFlag, m_decoration, m_drawColor, m_fillColor, m_fontFamily, m_fontSizePt, m_fontStyle, m_inFooter, m_inTemplate, m_k, m_lineWidth, m_page, m_state, m_templateId, m_textColor, Open(), Out(), OutAscii(), and SetFont().

Referenced by Cell(), Close(), and wxPdfTable::Write().

{
  if (m_inTemplate)
  {
    wxLogError(_("wxPdfDocument::AddPage: Adding pages in templates is impossible. Current template ID is %d."), m_templateId);
    return;
  }

  // Start a new page
  if (m_state == 0)
  {
    Open();
  }
  wxString family = m_fontFamily;
  wxString style = m_fontStyle;
  if (m_decoration & wxPDF_FONT_UNDERLINE)
  {
    style += wxString(_T("U"));
  }
  if (m_decoration & wxPDF_FONT_OVERLINE)
  {
    style += wxString(_T("O"));
  }
  if (m_decoration & wxPDF_FONT_STRIKEOUT)
  {
    style += wxString(_T("S"));
  }
  double size = m_fontSizePt;
  double lw = m_lineWidth;
  wxPdfColour dc = m_drawColor;
  wxPdfColour fc = m_fillColor;
  wxPdfColour tc = m_textColor;
  bool cf = m_colorFlag;

  if (m_page > 0)
  {
    // Page footer
    m_inFooter = true;
    Footer();
    m_inFooter = false;
    // Close page
    EndPage();
  }

  // Start new page
  BeginPage(orientation);

  // Set line cap style to square
  Out("2 J");

  // Set line width
  m_lineWidth = lw;
  OutAscii(Double2String(lw*m_k,2)+wxString(_T(" w")));

  // Set font
  if (family.Length() > 0)
  {
    SetFont(family, style, size);
  }

  // Set colors
  m_drawColor = dc;
  if (dc != wxPdfColour(0))
  {
    OutAscii(dc.GetColor(true));
  }
  m_fillColor = fc;
  if (fc != wxPdfColour(0))
  {
    OutAscii(fc.GetColor(false));
  }
  m_textColor = tc;
  m_colorFlag = cf;

  // Page header
  Header();

  // Restore line width
  if (m_lineWidth != lw)
  {
    m_lineWidth = lw;
    OutAscii(Double2String(lw*m_k,2)+wxString(_T(" w")));
  }

  // Restore font
  if(family.Length() > 0)
  {
    SetFont(family, style, size);
  }

  // Restore colors
  if (m_drawColor != dc)
  {
    m_drawColor = dc;
    OutAscii(dc.GetColor(true));
  }
  if (m_fillColor != fc)
  {
    m_fillColor = fc;
    OutAscii(fc.GetColor(false));
  }
  m_textColor = tc;
  m_colorFlag = cf;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index