G
Guest
In mine webapp I'm using the following code to generate a PDF and show it in
the browser:
private Reports.repZipRequest crReportDocument;
crReportDocument = new Reports.repZipRequest();
System.IO.MemoryStream ReportStream =
(System.IO.MemoryStream)crReportDocument.ExportToStream(
ExportFormatType.PortableDocFormat);
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.BinaryWrite(ReportStream.ToArray());
Response.End();
and I use the following code to print a report directly to a network printer:
private Reports.repZipRequest crReportDocument;
crReportDocument = new Reports.repZipRequest();
crReportDocument.PrintOptions.PrinterName = @"\\SERVER\PRINTERNAME";
crReportDocument.PrintToPrinter(1, true, 0, 0);
The first code works well but the second gives an error (Error in file
c:\.....: request cancelled by user.".
I've read that I have to edit the machine.config and change
username="machine" into username="SYSTEM" (<ProcessModel> tag). When I do
that, code 2 works and the report is printed, but code1 doesn't work anymore.
Please help. Anyone any idea?
Edward
the browser:
private Reports.repZipRequest crReportDocument;
crReportDocument = new Reports.repZipRequest();
System.IO.MemoryStream ReportStream =
(System.IO.MemoryStream)crReportDocument.ExportToStream(
ExportFormatType.PortableDocFormat);
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/pdf";
Response.BinaryWrite(ReportStream.ToArray());
Response.End();
and I use the following code to print a report directly to a network printer:
private Reports.repZipRequest crReportDocument;
crReportDocument = new Reports.repZipRequest();
crReportDocument.PrintOptions.PrinterName = @"\\SERVER\PRINTERNAME";
crReportDocument.PrintToPrinter(1, true, 0, 0);
The first code works well but the second gives an error (Error in file
c:\.....: request cancelled by user.".
I've read that I have to edit the machine.config and change
username="machine" into username="SYSTEM" (<ProcessModel> tag). When I do
that, code 2 works and the report is printed, but code1 doesn't work anymore.
Please help. Anyone any idea?
Edward