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

bool PoDoFo::PdfPage::SetPageWidth ( int  newWidth )

Set the current page width in PDF Units

Returns:
true if successfull, false otherwise

Definition at line 414 of file PdfPage.cpp.

References PoDoFo::PdfVariant::GetArray(), GetInheritedKeyFromObject(), PoDoFo::PdfElement::GetObject(), and PoDoFo::PdfVariant::IsArray().

{
    PdfObject*   pObjMediaBox;
        
    // Take advantage of inherited values - walking up the tree if necessary
    pObjMediaBox = const_cast<PdfObject*>(GetInheritedKeyFromObject( "MediaBox", this->GetObject() ));
    
    // assign the value of the box from the array
    if ( pObjMediaBox && pObjMediaBox->IsArray() )
    {
        pObjMediaBox->GetArray()[2].SetNumber(newWidth);

        PdfObject*   pObjCropBox;

        // Take advantage of inherited values - walking up the tree if necessary
        pObjCropBox = const_cast<PdfObject*>(GetInheritedKeyFromObject( "CropBox", this->GetObject() ));

        if ( pObjCropBox && pObjCropBox->IsArray() )
        {
            pObjCropBox->GetArray()[2].SetNumber(newWidth);
            return true;
        }else
        {
            return false;
        }
    }else
    {
        return false;
    }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index