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

const PdfRect PoDoFo::PdfPage::GetPageBox ( const char *  inBox ) const [private]

Get the bounds of a specified page box in PDF units. This function is internal, since there are wrappers for all standard boxes

Returns:
PdfRect the page box

Definition at line 222 of file PdfPage.cpp.

References PoDoFo::PdfRect::FromArray(), PoDoFo::PdfVariant::GetArray(), GetInheritedKeyFromObject(), PoDoFo::PdfVecObjects::GetObject(), PoDoFo::PdfElement::GetObject(), PoDoFo::PdfObject::GetOwner(), PoDoFo::PdfVariant::GetReference(), PoDoFo::PdfVariant::IsArray(), and PoDoFo::PdfVariant::IsReference().

{
    PdfRect  pageBox;
    const PdfObject*   pObj;
        
    // Take advantage of inherited values - walking up the tree if necessary
    pObj = GetInheritedKeyFromObject( inBox, this->GetObject() );
    

    // Sometime page boxes are defined using reference objects
    while ( pObj && pObj->IsReference() )
    {
        pObj = this->GetObject()->GetOwner()->GetObject( pObj->GetReference() );
    }

    // assign the value of the box from the array
    if ( pObj && pObj->IsArray() )
    {
        pageBox.FromArray( pObj->GetArray() );
    }
    else if ( strcmp( inBox, "ArtBox" ) == 0   ||
              strcmp( inBox, "BleedBox" ) == 0 ||
              strcmp( inBox, "TrimBox" ) == 0  )
    {
        // If those page boxes are not specified then
        // default to CropBox per PDF Spec (3.6.2)
        pageBox = GetPageBox( "CropBox" );
    }
    else if ( strcmp( inBox, "CropBox" ) == 0 )
    {
        // If crop box is not specified then
        // default to MediaBox per PDF Spec (3.6.2)
        pageBox = GetPageBox( "MediaBox" );
    }
    
    return pageBox;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index