Printing problem(print not come on the center of the page)
-
Respected All Regards! i developed aclass of printing, it works fine but the print did not come on the middle of the page,that's start from the TOP LEFT margine of the page,plz mentioned the changes so that i may able to get the print on the center of the page. Thanks n advance. David david
-
Respected All Regards! i developed aclass of printing, it works fine but the print did not come on the middle of the page,that's start from the TOP LEFT margine of the page,plz mentioned the changes so that i may able to get the print on the center of the page. Thanks n advance. David david
Following the "brute force and pig-ignorance" approach, I do the following to print an image (C code, but it should give the idea):
// get the printer height and width
iPageX = GetDeviceCaps (hdcPrn, HORZRES) ;
iPageY = GetDeviceCaps (hdcPrn, VERTRES) ;// To make neater printouts, make a border of 10%
iTopMargin = iPageY / 10;
iLeftMargin = iPageX / 10;// Leaving the area we potentially use as follows:
iPageX = iPageX - iLeftMargin - iLeftMargin;
iPageY = iPageY - iTopMargin - iTopMargin;// ############################################
// Left out here - do some stuff to get my image and the page into the
// same aspect ratio
// ############################################// Copy the DI bitmap to the printer
StretchDIBits(hdcPrn, iLeftMargin, iTopMargin, iPageX , iPageY,
0, 0, iImageMaxX, iImageMaxY, lvpBits, lpBitMapHeader,
DIB_RGB_COLORS, SRCCOPY);I hope I haven't missed any relevant steps!