How to print document through C# coding? - TechRepublic
General discussion
July 21, 2006 at 04:33 AM
rajkar001

How to print document through C# coding?

by rajkar001 . Updated 17 years, 3 months ago

Hi everybody,

Can anybody tell me how to print a document throgh C# coding.
I did using streamreader, but then document is not getting printed as it originally is.Bullets,styles,spaces are different in the print out from that in screen.

then i tried using printdialog, but a blank page is getting printed or the path of document is getting printed instead of data in document.
then i tried copying the document into a rich text box and printed it from there.

I was able to get the printout as normal, but if the document is only of RTF , the coding is working.
the coding fails 4 word documents,pdf documents,etc.

=> Is there any general coding to print any kind of document through C# .

Actually i am developing an application where user when clicks ‘print’ button,it should be printed.user should not be given a chance to modify printer or page settings,etc.

Thanks & Regards,
Karthik

This discussion is locked

All Comments