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

void PoDoFo::PdfPainter::BeginText ( double  dX,
double  dY 
) [inherited]

Begin drawing multiple text strings on a page using a given font object. You have to call SetFont before calling this function.

If you want more simpler text output and do not need the advanced text position features of MoveTextPos use DrawText which is easier.

Parameters:
dXthe x coordinate
dYthe y coordinate
See also:
SetFont()
AddText()
MoveTextPos()
EndText()

Definition at line 714 of file PdfPainter.cpp.

References PoDoFo::PdfPainter::AddToPageResources(), PoDoFo::PdfStream::Append(), PoDoFo::ePdfError_InvalidHandle, PoDoFo::PdfFont::GetFontCharSpace(), PoDoFo::PdfFont::GetFontScale(), PoDoFo::PdfFont::GetFontSize(), PoDoFo::PdfFont::GetIdentifier(), PoDoFo::PdfName::GetName(), PoDoFo::PdfElement::GetObject(), PoDoFo::PdfPainter::m_isTextOpen, PoDoFo::PdfPainter::m_oss, PoDoFo::PdfPainter::m_pCanvas, PoDoFo::PdfPainter::m_pFont, PoDoFo::PdfPainter::m_pPage, PODOFO_RAISE_ERROR, PODOFO_RAISE_LOGIC_IF, and PoDoFo::PdfObject::Reference().

{
    PODOFO_RAISE_LOGIC_IF( !m_pCanvas, "Call SetPage() first before doing drawing operations." );

    if( !m_pFont || !m_pPage ||  m_isTextOpen)
    {
        PODOFO_RAISE_ERROR( ePdfError_InvalidHandle );
    }

    this->AddToPageResources( m_pFont->GetIdentifier(), m_pFont->GetObject()->Reference(), PdfName("Font") );

    m_oss.str("");
    m_oss << "BT" << std::endl << "/" << m_pFont->GetIdentifier().GetName()
          << " "  << m_pFont->GetFontSize()
          << " Tf" << std::endl;

    //if( m_pFont->GetFontScale() != 100.0F ) - this value is kept between text blocks
    m_oss << m_pFont->GetFontScale() << " Tz" << std::endl;

    //if( m_pFont->GetFontCharSpace() != 0.0F )  - this value is kept between text blocks
    m_oss << m_pFont->GetFontCharSpace() * m_pFont->GetFontSize() / 100.0 << " Tc" << std::endl;

    m_oss << dX << " " << dY << " Td" << std::endl ;

    m_pCanvas->Append( m_oss.str() );

      m_isTextOpen = true;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index