Hi,
Currently Podofo returns a zero width/height rect when
PdfPage::GetPageBox() is called on a page box not defined on a specific
page. Pdf specs (3.6.2) provide a number of fallbacks for these cases :
- ArtBox, BleedBox and TrimBox should default to CropBox
- CropBox should default to MediaBox
Here is a patch which implement those fallbacks :
Index: src/PdfPage.cpp
===================================================================
--- src/PdfPage.cpp (revision 1155)
+++ src/PdfPage.cpp (working copy)
@@ -205,7 +205,23 @@
// 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;
}
Regards,
Jean Ghali
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users