Click to See Complete Forum and Search --> : Win32 and printing


mgarcia
March 31st, 1999, 10:47 AM
Ok, I need help in initializing/formatting the printerDC.

I read contents of file into a buffer.

then this code executes:

if( StartDoc(hdcPrn, &di) > 0)

{

if(StartPage(hdcPrn) > 0)

{

TextOut(hdcPrn,0,0,szText,lstrlen(szText) );

if( EndPage(hdcPrn) > 0)

EndDoc(hdcPrn);

else

{

free(szText);

DeleteDC(hdcPrn);

return FALSE;

}

}

}

and what happens is the file prints but all on one line!!!!

Even the ASCII \n character is ignored. What is going on?

What variables must I set to properly format my printjob so

that the file prints out correctly?


please no flaming.


thanxs


mgarcia

S Cheeran
March 31st, 1999, 10:40 PM
Where do you increment your coordinates where you write, where do you check for the page boundaries and move to the next page. If you don't write it on the updated next line point it is not going to print it on another line. This is a dc, just like a sheet of paper, if you write on the same line you get it on the same line. Once you finish a page you write it into the printer, don't think since the paper is scrolling you can write it on the same point and still get it on a new line. The dc is mapped one to one onto the paper once you say print this page to the printer device.

Dave Lorde
April 1st, 1999, 04:39 AM
Your TextOut x and y co-ordinates are always zero, so it will always print in the same place. You have to increase the y ordinate value by the height of a line each time.


Dave