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

wxPdfDocument::wxPdfDocument ( int  orientation = wxPORTRAIT,
const wxString &  unit = wxString(_T("mm")),
wxPaperSize  format = wxPAPER_A4 
)

Constructor.

Parameters:
orientationDefines the default page orientation. Possible values are:

  • wxPORTRAIT portrait layout (default)
  • wxLANDSCAPE landscape layout
unitDefines the user units. Possible values are:

  • "mm" millimeter (1 mm = 0.0394 in = 2.833 pt = 0.1 cm) (default)
  • "cm" centimeter (1 cm = 0.394 in = 28.33 pt = 10 mm)
  • "pt" points (1 pt = 1/72 in = 0.0353 cm = 0.353 mm)
  • "in" inch (1 in = 72 pt = 2.54 cm = 25.4 mm)
formatDefines the page format. All known wxWidgets paper types are allowed. (Default: wxPAPER_A4)

Definition at line 36 of file pdfdoc.cpp.

References wxPdfFont::GetIndex(), InitializeCoreFonts(), m_angle, m_annotations, m_cMargin, m_colorFlag, m_curOrientation, m_currentExtGState, m_currentFont, m_currentParser, m_currentSource, m_decoration, m_defOrientation, m_drawColor, m_encrypted, m_encryptor, m_extGSLookup, m_extGStates, m_fh, m_fhPt, m_fillColor, m_fontFamily, m_fonts, m_fontSizePt, m_fontStyle, m_fontSubsetting, m_formAnnotations, m_formFields, m_fw, m_fwPt, m_gradients, m_h, m_hPt, m_images, m_imgscale, m_importVersion, m_inFooter, m_inTemplate, m_inTransform, m_javascript, m_k, m_lasth, m_lineWidth, m_links, m_maxOutlineLevel, m_n, m_namedLinks, m_offsets, m_orientationChanges, m_outlineRoot, m_page, m_pageLinks, m_pages, m_parsers, m_PDFVersion, m_radioGroups, m_spotColors, m_state, m_templateId, m_templatePrefix, m_templates, m_textColor, m_viewerPrefs, m_w, m_wPt, m_ws, m_zapfdingbats, m_zoomFactor, SetAutoPageBreak(), SetCompression(), SetDisplayMode(), SetFont(), SetFontPath(), SetMargins(), and wxPDF_FONT_NORMAL.

{
  // Allocate arrays
  m_currentFont = NULL;

  m_page       = 0;
  m_n          = 2;
  m_offsets = new wxPdfOffsetHashMap();

  m_pages = new wxPdfPageHashMap();
  m_orientationChanges = new wxPdfBoolHashMap();

  m_state      = 0;

  InitializeCoreFonts();
  m_fonts       = new wxPdfFontHashMap();
  m_images      = new wxPdfImageHashMap();
  m_pageLinks   = new wxPdfPageLinksMap();
  m_links       = new wxPdfLinkHashMap();
  m_namedLinks  = new wxPdfNamedLinksMap();
  m_diffs       = new wxPdfDiffHashMap();
  m_extGStates  = new wxPdfExtGStateMap();
  m_extGSLookup = new wxPdfExtGSLookupMap();
  m_currentExtGState = 0;
  m_gradients   = new wxPdfGradientMap();
  m_annotations = new wxPdfAnnotationsMap();
  m_formAnnotations = new wxPdfFormAnnotsMap();
  m_formFields  = new wxPdfFormFieldsMap();
  m_radioGroups = new wxPdfRadioGroupMap();
  m_templates   = new wxPdfTemplatesMap();
  m_parsers     = new wxPdfParserMap();
  m_spotColors  = new wxPdfSpotColourMap();

  m_outlineRoot     = -1;
  m_maxOutlineLevel = 0;

  m_inFooter   = false;
  m_lasth      = 0;
  m_fontFamily = _T("");
  m_fontStyle  = _T("");
  m_fontSizePt = 12;
  m_decoration = wxPDF_FONT_NORMAL;
  m_fontSubsetting = true;

  m_drawColor  = wxPdfColour();
  m_fillColor  = wxPdfColour();
  m_textColor  = wxPdfColour();
  m_colorFlag  = false;
  m_ws         = 0;

  // Scale factor
  if (unit == _T("pt"))
  {
    m_k = 1.;
  }
  else if (unit == _T("in"))
  {
    m_k = 72.;
  }
  else if (unit == _T("cm"))
  {
    m_k = 72. / 2.54;
  }
  else // if (unit == "mm") or unknown
  {
    m_k = 72. / 25.4;
  }

  // Initialize image scale factor
  m_imgscale = 1.;

  // Page format
  wxPrintPaperDatabase* printPaperDatabase = new wxPrintPaperDatabase;
  printPaperDatabase->CreateDatabase();
  wxPrintPaperType* paperType = printPaperDatabase->FindPaperType(format);
  if (paperType == NULL)
  {
    paperType = printPaperDatabase->FindPaperType(wxPAPER_A4);
  }
  wxSize paperSize = paperType->GetSize();
  m_fwPt = paperSize.GetWidth() / 254. * 72.;
  m_fhPt = paperSize.GetHeight() / 254. * 72.;
  delete printPaperDatabase;

  m_fw = m_fwPt / m_k;
  m_fh = m_fhPt / m_k;

  // Page orientation
  if (orientation == wxLANDSCAPE)
  {
    m_defOrientation = wxLANDSCAPE;
    m_wPt = m_fhPt;
    m_hPt = m_fwPt;
  }
  else // orientation == wxPORTRAIT or unknown
  {
    m_defOrientation = wxPORTRAIT;
    m_wPt = m_fwPt;
    m_hPt = m_fhPt;
  }

  m_curOrientation = m_defOrientation;
  m_w = m_wPt / m_k;
  m_h = m_hPt / m_k;
  m_angle = 0;
  m_inTransform = 0;

  // Page margins (1 cm)
  double margin = 28.35 / m_k;
  SetMargins(margin, margin);

  // Interior cell margin (1 mm)
  m_cMargin = margin / 10;

  // Line width (0.2 mm)
  m_lineWidth = .567 / m_k;

  // Automatic page break
  SetAutoPageBreak(true, 2*margin);

  // Full width display mode
  SetDisplayMode(wxPDF_ZOOM_FULLWIDTH);
  m_zoomFactor = 100.;

  // Default viewer preferences
  m_viewerPrefs = 0;

  // Enable compression
  SetCompression(true);

  // Set default PDF version number
  m_PDFVersion = _T("1.3");
  m_importVersion = m_PDFVersion;

  m_encrypted = false;
  m_encryptor = NULL;

  m_javascript = wxEmptyString;

  m_inTemplate = false;
  m_templateId = 0;
  m_templatePrefix = _T("/TPL");

  m_currentParser = NULL;
  m_currentSource = wxEmptyString;

  SetFontPath();
  SetFont(_T("ZapfDingBats"), _T(""), 9);
  m_zapfdingbats = m_currentFont->GetIndex();
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index