N
Nikolay Seksenov
I am developing VB.Net Web application to be used in our
department intranet. I created a web-based report using
Crystal Reports. I would like to print the report from the
web server instead of printing from the browser because
the latest will add additional text to the pages and it
also requires printing each page separately. In order to
do this I followed the steps described in
article "Printing Web-Based Reports from the Server",
which suggested to change the <ProcessModel> tag in
machine.config file (userName="SYSTEM" instead of
userName="machine") and also completed the steps described
in related articles Q152451 and Q184291: I added a local
printer on server's LPT1 port and then attached the
network printer to lpt1 using "net use lpt1:
\\server\printer" command. Then I made this printer
default printer and printed test page ok. Also I copied
registry settings from HKEY_CURRENT_USER to
HKEY_USERS\.DEFAULT as described in articles above.
During the report page Page_Load event the following code
is executed:
Dim MyRpt As New Crystal1
Dim MyPrinter As New System.Drawing.Printing.PrintDocument
Dim strPrinterName As String
....
strPrinterName = MyPrinter.PrinterSettings.PrinterName()
'Checked the variable above in debug mode: contains
correct printer name
MyRpt.PrintOptions.PrinterName = strPrinterName
MyRpt.PrintToPrinter(1, False, 0, 0)
When executing the last command got the error message with
heading: "Printers Folder" and text: "There was an error
found when printing the document "..." to LPT1:. Do you
want to retry or cancel the job" with Retry and Cancel
buttons.
Before clicking on any of those buttons I opened the
virtual Printers directory of the web server and found
the document in the Document List queue with the status
of "Error - Printing". After clicking on Cancel the
document disappears from the Document List.
Can somebody help?
department intranet. I created a web-based report using
Crystal Reports. I would like to print the report from the
web server instead of printing from the browser because
the latest will add additional text to the pages and it
also requires printing each page separately. In order to
do this I followed the steps described in
article "Printing Web-Based Reports from the Server",
which suggested to change the <ProcessModel> tag in
machine.config file (userName="SYSTEM" instead of
userName="machine") and also completed the steps described
in related articles Q152451 and Q184291: I added a local
printer on server's LPT1 port and then attached the
network printer to lpt1 using "net use lpt1:
\\server\printer" command. Then I made this printer
default printer and printed test page ok. Also I copied
registry settings from HKEY_CURRENT_USER to
HKEY_USERS\.DEFAULT as described in articles above.
During the report page Page_Load event the following code
is executed:
Dim MyRpt As New Crystal1
Dim MyPrinter As New System.Drawing.Printing.PrintDocument
Dim strPrinterName As String
....
strPrinterName = MyPrinter.PrinterSettings.PrinterName()
'Checked the variable above in debug mode: contains
correct printer name
MyRpt.PrintOptions.PrinterName = strPrinterName
MyRpt.PrintToPrinter(1, False, 0, 0)
When executing the last command got the error message with
heading: "Printers Folder" and text: "There was an error
found when printing the document "..." to LPT1:. Do you
want to retry or cancel the job" with Retry and Cancel
buttons.
Before clicking on any of those buttons I opened the
virtual Printers directory of the web server and found
the document in the Document List queue with the status
of "Error - Printing". After clicking on Cancel the
document disappears from the Document List.
Can somebody help?