Showing
1 changed file
with
7 additions
and
2 deletions
@@ -130,6 +130,10 @@ bool PrintJob::directPrintPdf(std::string name, | @@ -130,6 +130,10 @@ bool PrintJob::directPrintPdf(std::string name, | ||
130 | 130 | ||
131 | bool PrintJob::printPdf(std::string name) { | 131 | bool PrintJob::printPdf(std::string name) { |
132 | PRINTDLG pd; | 132 | PRINTDLG pd; |
133 | + DEVMODE* dm = static_cast<DEVMODE*>(GlobalAlloc(0, sizeof(DEVMODE))); | ||
134 | + ZeroMemory(dm, sizeof(DEVMODE)); | ||
135 | + dm->dmFields = DM_ORIENTATION; | ||
136 | + dm->dmOrientation = 2; | ||
133 | 137 | ||
134 | // Initialize PRINTDLG | 138 | // Initialize PRINTDLG |
135 | ZeroMemory(&pd, sizeof(pd)); | 139 | ZeroMemory(&pd, sizeof(pd)); |
@@ -137,10 +141,11 @@ bool PrintJob::printPdf(std::string name) { | @@ -137,10 +141,11 @@ bool PrintJob::printPdf(std::string name) { | ||
137 | 141 | ||
138 | // Initialize PRINTDLG | 142 | // Initialize PRINTDLG |
139 | pd.hwndOwner = nullptr; | 143 | pd.hwndOwner = nullptr; |
140 | - pd.hDevMode = nullptr; // Don't forget to free or store hDevMode. | 144 | + pd.hDevMode = dm; |
141 | pd.hDevNames = nullptr; // Don't forget to free or store hDevNames. | 145 | pd.hDevNames = nullptr; // Don't forget to free or store hDevNames. |
142 | pd.hDC = nullptr; | 146 | pd.hDC = nullptr; |
143 | - pd.Flags = 0x0004014C; | 147 | + pd.Flags = PD_USEDEVMODECOPIES | PD_RETURNDC | PD_PRINTSETUP | |
148 | + PD_NOSELECTION | PD_NOPAGENUMS; | ||
144 | pd.nCopies = 1; | 149 | pd.nCopies = 1; |
145 | pd.nFromPage = 0xFFFF; | 150 | pd.nFromPage = 0xFFFF; |
146 | pd.nToPage = 0xFFFF; | 151 | pd.nToPage = 0xFFFF; |
-
Please register or login to post a comment