CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2005

    Writing graphics to a Printer Device context

    Hi all,

    My aim is to get the handle of a printer and then pass some data to it for printing. so far I have managed to get the handle of printer:
    hdcPrn = GetPrinterDC()
    and then just for testing i captured the desktop screen but getting the handle of the screen and copied this data to the printer using BitBlt:
    where hdcScreen is the Device Context of the screen.

    Now what i want to do is read some data from a word document using Creatfile() and ReadFile() and then write whatever data I get into the Device DC of the printer. I am sure Writefile() or TextOut() will not work b'coz the .doc might contain images also. I want to know if there is any command or method to write a buffer data into a device DC.

    Last edited by leojose; May 12th, 2005 at 11:10 PM. Reason: changed title

  2. #2
    Join Date
    May 2005

    Re: Writing graphics to a Device context

    there is much easier way to do what you asking.
    all you have to do is use Word Automation, and simply by couple of commands you open a doc file and can priniting it, without any pharsing of the document i did it once with Excel!

    the code should look somehting like that:

    Applcation appWord;
    appWord.Open ( ...) //give the file name to open + other parameters
    appWord.PrintOut( ...) // print the opened file

    basically thats all you have to do.

    if you got problem let me know.


Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.