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

PdfRect PoDoFo::PdfPage::CreateStandardPageSize ( const EPdfPageSize  ePageSize,
bool  bLandscape = false 
) [static]

Creates a PdfRect with the page size as values which is needed to create a PdfPage object from an enum which are defined for a few standard page sizes.

Parameters:
ePageSizethe page size you want
bLandscapecreate a landscape pagesize instead of portrait (by exchanging width and height)
Returns:
a PdfRect object which can be passed to the PdfPage constructor

Definition at line 129 of file PdfPage.cpp.

References PoDoFo::ePdfPageSize_A0, PoDoFo::ePdfPageSize_A1, PoDoFo::ePdfPageSize_A2, PoDoFo::ePdfPageSize_A3, PoDoFo::ePdfPageSize_A4, PoDoFo::ePdfPageSize_A5, PoDoFo::ePdfPageSize_A6, PoDoFo::ePdfPageSize_Legal, PoDoFo::ePdfPageSize_Letter, PoDoFo::ePdfPageSize_Tabloid, PoDoFo::PdfRect::GetHeight(), PoDoFo::PdfRect::GetWidth(), PoDoFo::PdfRect::SetHeight(), and PoDoFo::PdfRect::SetWidth().

Referenced by EncryptTest::CreatedEncrypedPdf(), PagesTreeTest::CreateTestTreeCustom(), and PagesTreeTest::CreateTestTreePoDoFo().

{
    PdfRect rect;

    switch( ePageSize ) 
    {
        case ePdfPageSize_A0:
            rect.SetWidth( 2384.0 );
            rect.SetHeight( 3370.0 );
            break;

        case ePdfPageSize_A1:
            rect.SetWidth( 1684.0 );
            rect.SetHeight( 2384.0 );
            break;

        case ePdfPageSize_A2:
            rect.SetWidth( 1191.0 );
            rect.SetHeight( 1684.0 );
            break;
            
        case ePdfPageSize_A3:
            rect.SetWidth( 842.0 );
            rect.SetHeight( 1190.0 );
            break;

        case ePdfPageSize_A4:
            rect.SetWidth( 595.0 );
            rect.SetHeight( 842.0 );
            break;

        case ePdfPageSize_A5:
            rect.SetWidth( 420.0 );
            rect.SetHeight( 595.0 );
            break;

        case ePdfPageSize_A6:
            rect.SetWidth( 297.0 );
            rect.SetHeight( 420.0 );
            break;

        case ePdfPageSize_Letter:
            rect.SetWidth( 612.0 );
            rect.SetHeight( 792.0 );
            break;
            
        case ePdfPageSize_Legal:
            rect.SetWidth( 612.0 );
            rect.SetHeight( 1008.0 );
            break;

        case ePdfPageSize_Tabloid:
            rect.SetWidth( 792.0 );
            rect.SetHeight( 1224.0 );
            break;

        default:
            break;
    }

    if( bLandscape ) 
    {
        double dTmp = rect.GetWidth();
        rect.SetWidth ( rect.GetHeight() );
        rect.SetHeight(  dTmp );
    }

    return rect;
}

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