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

int wxPdfDocument::SetSourceFile ( const wxString &  filename,
const wxString &  password = wxEmptyString 
)

Sets a source file for the external template feature.

Selects the source for the external template feature. A parser is setup for importing pages from the PDF document. Although wxPdfDocument usually creates PDF documents conforming to version 1.3 of the PDF standard, parsing of documents conforming to versions up to 1.6 is supported. If pages are aimported from documents conforming to a higher version than 1.3 the version used by wxPdDocument is updated accordingly.

Parameters:
filenamea valid filename
passworda valid user or owner password if the PDF document is encrypted
Returns:
the number of available pages, or 0 if the document could not be opened
See also:
ImportPage(), UseTemplate()

Attention: Access permissions for printing, copying and extracting text or graphics are required. If a PDF document does not have these access permissions, it cannot be used as a source for the external template feature.

Definition at line 254 of file pdftemplate.cpp.

References wxPdfParser::GetPageCount(), wxPdfParser::IsOk(), m_currentParser, and m_currentSource.

{
  int pageCount = 0;
  if (filename != wxEmptyString)
  {
    m_currentSource = filename;
    m_currentParser = new wxPdfParser(filename, password);
    if (m_currentParser->IsOk())
    {
      (*m_parsers)[filename] = m_currentParser;
      pageCount = m_currentParser->GetPageCount();
    }
    else
    {
      wxLogError(_("wxPdfDocument::SetSourceFile: Parser creation failed."));
      m_currentSource = wxEmptyString;
      delete m_currentParser;
      m_currentParser = NULL;
    }
  }
  else
  {
    wxLogError(_("wxPdfDocument::SetSourceFile: No source file name given."));
  }
  return pageCount;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index