Thread: Writing data to a Printer Device Context

  1. #1
    Registered User
    Join Date
    May 2005

    Writing data to a Printer Device Context

    Hi all,

    I have created a character buffer (char buff[]) which contains the data of a word document (the document contains text and images).
    i would like to pass this data onto a printer. I have managed to get the handle of the printer using GetPrinterDC. but what i can't figure out is how am i going to pass my buffer data to this DC?
    If given the handle of a window, we can find its DC and then pass that data to the printer DC using BitBlt, but in my case i don't have a handle, but only an array of characters which represent some image.
    Can somone suggest a method?

  2. #2
    Registered User
    Join Date
    Feb 2002
    I think the easiest way to print the word document, is to use the Com objects for Word.
    If you want to print the document directly to the printer DC, you first have to interpret the document, and then format the text and graphics for the dc..

  3. #3
    Registered User
    Join Date
    May 2005
    hi knutso,

    I wouldn't like to stick to just MS-word douments. basically, my buffer will contain binary data of any image or text document. The data could be an .swf format, or some vector diagram etc. i would then send this data to a postscript printer which will generate a .ps file. using a ps2pdf converter i can then recover whatever image is there in a pdf file.
    One way to passing any image to a printer is by using the BitBlt function( we can print text using TextOut, ellipse by using the Ellipse() function etc.)
    But BitBlt requires a DC of a window that contains an image. I have succesfully printed the image of the desktop on a .pdf file but when it comes to data enclosed in a character string I don't know how to print it.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How get data acquisition from printer using winsock?
    By Galvatron in forum Networking/Device Communication
    Replies: 1
    Last Post: 05-21-2008, 03:16 AM
  2. Writing data to serial port
    By HAssan in forum C Programming
    Replies: 4
    Last Post: 10-16-2006, 12:07 PM
  3. Writing and modifying data in a file
    By Micko in forum C Programming
    Replies: 2
    Last Post: 02-17-2005, 03:42 AM
  4. Other Routines For Setting a pixel onto a Device context
    By MicroFiend in forum Game Programming
    Replies: 21
    Last Post: 07-16-2004, 08:09 AM
  5. HUGE fps jump
    By DavidP in forum Game Programming
    Replies: 23
    Last Post: 07-01-2004, 10:36 AM