CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 1999
    Posts
    1

    Win32 and printing



    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



  2. #2
    Join Date
    Apr 1999
    Posts
    6

    Re: Win32 and printing



    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.

  3. #3
    Join Date
    Apr 1999
    Posts
    383

    Re: Win32 and printing



    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured