Skip to content

Open any type of file,click print button programatically.

saravana narayanan

Asked Dec 9, 2011, 7:20 PM EST1 answer
Share
LinkedInX
In windows application iam using System.Diagnostics.Process.Start(filepath) to open the file and i would to click the print option thro programatically.
   
Whether we can able to achieve this in windows application. Kindly help me.

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Senthilkumar
    0
    Hi,

    when you open the file, if you want to print that document then .net supports to print the document.

    You have to use the System.Drawing.Print namespace.

    Any way you know the path of the document, then you have to use the streamreader to read the file and we have to fix the number of lines per page.

    The PrintDocument class will be used to set the peoperties and print() method will be used to print.

    Please go through this link, you will get the code.

    http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument.print.aspx


    Thanks,
    Senthil.
    0