diff --git a/include/wx/html/htmprint.h b/include/wx/html/htmprint.h
index 77a34fcde9..6098b9bd94 100644
--- a/include/wx/html/htmprint.h
+++ b/include/wx/html/htmprint.h
@@ -156,9 +156,11 @@ public:
void SetMargins(float top = 25.2f, float bottom = 25.2f, float left = 25.2f, float right = 25.2f,
float spaces = 5);
- // sets margins in milimeters. Defaults to 1 inch for margins and 0.5cm for space
+ // sets margins in millimeters. Defaults to 1 inch for margins and 0.5cm for space
// between text and header and/or footer
+ void SetMargins(const wxPageSetupDialogData& pageSetupData);
+
// wxPrintout stuff:
bool OnPrintPage(int page) wxOVERRIDE;
bool HasPage(int page) wxOVERRIDE;
diff --git a/interface/wx/html/htmprint.h b/interface/wx/html/htmprint.h
index 62b011d369..7d0ceaf15e 100644
--- a/interface/wx/html/htmprint.h
+++ b/interface/wx/html/htmprint.h
@@ -444,5 +444,12 @@ public:
float left = 25.2,
float right = 25.2,
float spaces = 5);
+
+ /**
+ Sets margins from wxPageSetupDialogData.
+
+ @since 3.1.0
+ */
+ void SetMargins(const wxPageSetupDialogData& pageSetupData);
};
diff --git a/src/html/htmprint.cpp b/src/html/htmprint.cpp
index b8b860a5fc..250e807b99 100644
--- a/src/html/htmprint.cpp
+++ b/src/html/htmprint.cpp
@@ -593,8 +593,13 @@ void wxHtmlPrintout::SetMargins(float top, float bottom, float left, float right
m_MarginSpace = spaces;
}
-
-
+void wxHtmlPrintout::SetMargins(const wxPageSetupDialogData& pageSetupData)
+{
+ SetMargins(pageSetupData.GetMarginTopLeft().y,
+ pageSetupData.GetMarginBottomRight().y,
+ pageSetupData.GetMarginTopLeft().x,
+ pageSetupData.GetMarginBottomRight().x);
+}
void wxHtmlPrintout::SetFonts(const wxString& normal_face, const wxString& fixed_face,
const int *sizes)
@@ -818,10 +823,7 @@ wxHtmlPrintout *wxHtmlEasyPrinting::CreatePrintout()
p->SetFooter(m_Footers[0], wxPAGE_EVEN);
p->SetFooter(m_Footers[1], wxPAGE_ODD);
- p->SetMargins(m_PageSetupData->GetMarginTopLeft().y,
- m_PageSetupData->GetMarginBottomRight().y,
- m_PageSetupData->GetMarginTopLeft().x,
- m_PageSetupData->GetMarginBottomRight().x);
+ p->SetMargins(*m_PageSetupData);
return p;
}