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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to print any type of file to printer

How to print any type of file to printer

Scheduled Pinned Locked Moved C#
tutorial
4 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.
  • K Offline
    K Offline
    khurram rathor
    wrote on last edited by
    #1

    Hello everyone, I'm trying to make an application that will select any file like .doc, .txt, .excel, .pdf and etc and the file will be printed to printer. If anyone can give me the idea about that. I will appreciate. :-O khurram rathor

    D 1 Reply Last reply
    0
    • K khurram rathor

      Hello everyone, I'm trying to make an application that will select any file like .doc, .txt, .excel, .pdf and etc and the file will be printed to printer. If anyone can give me the idea about that. I will appreciate. :-O khurram rathor

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

      It's already been done and it's called Windows Explorer. Right click on any file and click Print. It's what your going to be using anyway. You can't possibly add support for every file type and every version of each file type to your app to print it correctly. You'll just end up shelling out the job to the app that is associated to the file and it will do the printing. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      T 1 Reply Last reply
      0
      • D Dave Kreskowiak

        It's already been done and it's called Windows Explorer. Right click on any file and click Print. It's what your going to be using anyway. You can't possibly add support for every file type and every version of each file type to your app to print it correctly. You'll just end up shelling out the job to the app that is associated to the file and it will do the printing. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        T Offline
        T Offline
        Tim DuBois
        wrote on last edited by
        #3

        I wouldn't mind doing something similar, but only for word and publisher files. Can you tell us how to use the shell to talk to these programs? Or would that be program independant?

        D 1 Reply Last reply
        0
        • T Tim DuBois

          I wouldn't mind doing something similar, but only for word and publisher files. Can you tell us how to use the shell to talk to these programs? Or would that be program independant?

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

          Word and Excel use DDE (not support by the .NET BCL) to let the Shell tell Word or Excel what to do with the file. It's easy enough to see the commands. ALl you have to do is open Explorer, go to Folder Options/File Type and find the DOC type. Click on it and then click Advanced at the bottom of the window. You'll find the Print and PrintTo commands there plus the command line to launch Word and the DDE commands to send to it to get it to print the doc. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          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