471
472
double bleedH = options.bleeds.Left + options.bleeds.Right;
472
473
double bleedV = options.bleeds.Top + options.bleeds.Bottom;
473
474
StartPage( printerDC );
474
succeed = sendPSFile( tempFilePath, printerDC, page->width() + bleedH, page->height() + bleedV);
475
succeed = sendPSFile( tempFilePath, printerDC, page->width() + bleedH, page->height() + bleedV, (page->PageOri == 1));
475
476
EndPage( printerDC );
500
bool ScPrintEngine_GDI::sendPSFile( QString filePath, HDC printerDC, int pageWidth, int pageHeight )
501
bool ScPrintEngine_GDI::sendPSFile( QString filePath, HDC printerDC, int pageWidth, int pageHeight, bool landscape )
553
554
if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
557
// Match Postscript and GDI coordinate system
558
sprintf( (char*) sps.data, "0 %0.3f neg translate\n", (double) physicalHeight );
559
sps.numBytes = strlen( (char*) sps.data );
560
if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
563
// In case of landscape printing, pslib will rotate the page
564
// we must take that into account
567
sprintf( (char*) sps.data, "-90 rotate %0.3f %0.3f translate\n", (double) -pageHeight, 0.0);
568
sps.numBytes = strlen( (char*) sps.data );
569
if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
571
transx = ( physicalHeight - pageHeight ) / -2.0;
572
transy = ( physicalWidth - pageWidth ) / 2.0;
576
transx = ( physicalWidth - pageWidth ) / 2.0;
577
transy = ( physicalHeight - pageHeight ) / 2.0;
556
580
// Center the printed page in paper zone
557
transx = ( physicalWidth - pageWidth ) / 2.0;
558
transy = ( pageHeight - physicalHeight ) / 2.0 - pageHeight;
559
581
sprintf( (char*) sps.data, "%0.3f %0.3f translate\n", transx, transy );
560
582
sps.numBytes = strlen( (char*) sps.data );
561
583
if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )