---
 src/doc/PdfPage.cpp | 13 +++++++++----
 src/doc/PdfPage.h   |  5 +++++
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/doc/PdfPage.cpp b/src/doc/PdfPage.cpp
index e933732..d0437ee 100644
--- a/src/doc/PdfPage.cpp
+++ b/src/doc/PdfPage.cpp
@@ -105,10 +105,8 @@ PdfPage::~PdfPage()
 }
void PdfPage::InitNewPage( const PdfRect & rSize )
-{
-    PdfVariant mediabox;
-    rSize.ToVariant( mediabox );
-    this->GetObject()->GetDictionary().AddKey( "MediaBox", mediabox );
+{
+    SetMediaBox(rSize);
// The PDF specification suggests that we send all available PDF Procedure sets
     this->GetObject()->GetDictionary().AddKey( "Resources", PdfObject( 
PdfDictionary() ) );
@@ -563,6 +561,13 @@ bool PdfPage::SetPageHeight(int newHeight)
     {
         return false;
     }
+}
+
+void PdfPage::SetMediaBox(const PdfRect & rSize)
+{
+    PdfVariant mediaBox;
+    rSize.ToVariant(mediaBox);
+    this->GetObject()->GetDictionary().AddKey("MediaBox", mediaBox);
 }
void PdfPage::SetTrimBox( const PdfRect & rSize )
diff --git a/src/doc/PdfPage.h b/src/doc/PdfPage.h
index fe04869..2e5fc23 100644
--- a/src/doc/PdfPage.h
+++ b/src/doc/PdfPage.h
@@ -108,6 +108,11 @@ class PODOFO_DOC_API PdfPage : public PdfElement, public 
PdfCanvas {
      *
      */
     bool SetPageHeight(int newHeight);
+
+    /** Set the mediabox in PDF Units
+    *  \param rSize a PdfRect specifying the mediabox of the page (i.e the 
/TrimBox key) in PDF units
+    */
+    void SetMediaBox(const PdfRect & rSize);
/** Set the trimbox in PDF Units
      *  \param rSize a PdfRect specifying the trimbox of the page (i.e the 
/TrimBox key) in PDF units
--
2.16.1.windows.1



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to