+ printout->OnPreparePrinting();
+
+ // Get some parameters from the printout, if defined
+ int fromPage, toPage;
+ int minPage, maxPage;
+ printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
+
+ if (maxPage == 0)
+ {
+ sm_lastError = wxPRINTER_ERROR;
+ wxEndBusyCursor();
+ return false;
+ }
+
+ // Only set min and max, because from and to have been
+ // set by the user
+ m_printDialogData.SetMinPage(minPage);
+ m_printDialogData.SetMaxPage(maxPage);
+
+ if (m_printDialogData.GetFromPage() < minPage)
+ m_printDialogData.SetFromPage( minPage );
+ if (m_printDialogData.GetToPage() > maxPage)
+ m_printDialogData.SetToPage( maxPage );
+