Skip to Content
0

How to print a crystal report directly from Web App to client PC without any human intervention?

Mar 09, 2017 at 09:56 AM

89

avatar image

Hi

I am printing a report like below. I can print when running my app locally but from the server how can I print it locally?

System.Drawing.Printing.PrintDocument oPrintDocument = new System.Drawing.Printing.PrintDocument();
                System.Drawing.Printing.PaperSize oPaperSize = new System.Drawing.Printing.PaperSize();


                string printerName = oPrintDocument.DefaultPageSettings.PrinterSettings.PrinterName;
                rpt.ReportDocument.PrintOptions.PrinterName = printerName;
                rpt.ReportDocument.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;


                oPaperSize.RawKind = (int)PaperKind.Custom;
                oPaperSize.Height = 500;
                oPaperSize.Width = 880;
                rpt.ReportDocument.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)oPaperSize.Kind;




                //Get the Copy times
                int nCopy = oPrintDocument.PrinterSettings.Copies;
                //Get the number of Start Page
                int sPage = oPrintDocument.PrinterSettings.FromPage;
                //Get the number of End Page
                int ePage = oPrintDocument.PrinterSettings.ToPage;
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Don Williams
Mar 09, 2017 at 04:14 PM
0

Hi Rehaan,

The problem is the WEB Server would need full permissions on the Users PC, that would be a huge permission/security issue. You would need to map the users PC/Printers to the WEB Server so you could select their printer.

Try Googling for examples... I doubt there is one though and if you do find one it would be a security issue...

Problem with most OS's and Browsers is the User MUST click something to give permissions to do the printing. UAC and Anti-Virus and Local Firewall software would block the attempt to "take control" of the local PC....

I suggest you find another way to do it....

Don

Share
10 |10000 characters needed characters left characters exceeded