Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Send data(bytes/stream) to a printer

Send data(bytes/stream) to a printer

Scheduled Pinned Locked Moved C#
comquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gauthee
    wrote on last edited by
    #1

    Hi, I am trying to print a file. The file can be word, ppt, xls etc etc. Instead using the COM objects i want to print the required file, so i thought i would open the file through binary reader and then send the bytes to the printer thereby printing the required file! Is there any other way? To print the required file The printer setting are set in a way that the file after print would be saved in a default location!

    gauthee

    S D 2 Replies Last reply
    0
    • G gauthee

      Hi, I am trying to print a file. The file can be word, ppt, xls etc etc. Instead using the COM objects i want to print the required file, so i thought i would open the file through binary reader and then send the bytes to the printer thereby printing the required file! Is there any other way? To print the required file The printer setting are set in a way that the file after print would be saved in a default location!

      gauthee

      S Offline
      S Offline
      snorkie
      wrote on last edited by
      #2

      In order to print directly to a printer, you have to send native codes in the language of the printer. This is all done for you in the background via the windows printer drivers. So, unless you have specific knowledge of each printer your application is going to use, use the windows print drivers. If you try to send a word file directly to the printer, nothing will happen. Hogan

      1 Reply Last reply
      0
      • G gauthee

        Hi, I am trying to print a file. The file can be word, ppt, xls etc etc. Instead using the COM objects i want to print the required file, so i thought i would open the file through binary reader and then send the bytes to the printer thereby printing the required file! Is there any other way? To print the required file The printer setting are set in a way that the file after print would be saved in a default location!

        gauthee

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        gauthee wrote:

        i thought i would open the file through binary reader and then send the bytes to the printer thereby printing the required file!

        And in each and every case, you'll be printing pages and pages of complete garbage. You can NOT just send what the application saved to disk to the printer and expect a nice image to appear on the paper. The printer doesn't know anything about any applications file format and applications don't save their files as a nice printed image on disk.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups