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. Printing documents

Printing documents

Scheduled Pinned Locked Moved C#
helpquestion
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.
  • M Offline
    M Offline
    msx23
    wrote on last edited by
    #1

    Hi, I'm working on a part of a program where I have a list of file paths and I want to write a method to send each file to the printer. Files in the list would be stuff like .txt and .doc. I've collected each path in a List docPaths = new List(); and I need to do something like:

    foreach (string file in docPaths)
    {
    //Send the file to the printer
    }

    What would people suggest is the best way to go about this? Thanks for any help

    D G 2 Replies Last reply
    0
    • M msx23

      Hi, I'm working on a part of a program where I have a list of file paths and I want to write a method to send each file to the printer. Files in the list would be stuff like .txt and .doc. I've collected each path in a List docPaths = new List(); and I need to do something like:

      foreach (string file in docPaths)
      {
      //Send the file to the printer
      }

      What would people suggest is the best way to go about this? Thanks for any help

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      Something like this (untried!):

      System.Diagnostics.Process printItem = new System.Diagnostics.Process();
      printItem.StartInfo.FileName = file;
      printItem.StartInfo.UseShellExecute = true;
      printItem.StartInfo.Verb = "print";
      printItem.Start();

      Dave
      BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
      Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)

      1 Reply Last reply
      0
      • M msx23

        Hi, I'm working on a part of a program where I have a list of file paths and I want to write a method to send each file to the printer. Files in the list would be stuff like .txt and .doc. I've collected each path in a List docPaths = new List(); and I need to do something like:

        foreach (string file in docPaths)
        {
        //Send the file to the printer
        }

        What would people suggest is the best way to go about this? Thanks for any help

        G Offline
        G Offline
        Giorgi Dalakishvili
        wrote on last edited by
        #3

        Sandeep Aparajit: How to Print File/String in C# ?[^]

        Giorgi Dalakishvili #region signature My Articles Asynchronous Registry Notification Using Strongly-typed WMI Classes in .NET [^] My blog #endregion

        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