Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello all...
i am trying to print huge amount of tiff files stored in a network path through my c# application.list of files are displayed in datagridview. through context menu strip i am trying to print selected files.
below is my code for printing...


ProcessStartInfo psi = new ProcessStartInfo();
psi.Arguments = "/P \"" + dataGridView1.SelectedRows[0].Cells[7].Value.ToString() + "\"";
psi.FileName = dataGridView1.SelectedRows[0].Cells[7].Value.ToString();
//Break. psi.Verbs = { "Open", "Print" };
psi.Verb = "Print";
Process.Start(psi).WaitForExit();

whenever i click on cntxtstrip the selected file opens up in MS-Picture manager rather than printing.. i want to send the selected tiff files directly to printter without showing the file..

Please help me to solve this issue.........
Posted
Comments
BillWoodruff 9-Oct-14 5:29am    
See if this is useful:

http://stackoverflow.com/questions/748735/unable-to-preview-multiple-page-tiff-files-in-net

1 solution

It's almost always bad to start a separate process; it's much better to do your own print. You can use the class System.Drawing.Printing.PrintDocument:
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument%28v=vs.110%29.aspx[^].

As to the TIFF, you can create a bitmap (if you have a file, open it using the constructor), and then use Graphics.DrawImage in your print page methods. Please see:
http://msdn.microsoft.com/en-us/library/system.drawing.graphics%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.drawing.bitmap%28v=vs.110%29.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900