In an asp application, there is a Print Receipt button. Clicking this button goes to a printerlocation.asp page. Here printer location is selected in the format \\computername\printersharename. Upon clicking the Submit button on printerlocation.asp page, it goes to printreceipt.asp page. This page prints the receipt to a dot matrix printer.
To accomplish dos based printing, dos based printing software is installed. Once this software is installed, the following line is written on printreceipt.asp page:
When I type dosprint. I see two methods; WriteOnPrinter and PrinterClose. I also see one property; Printername.
So, a sample code to send output to dot-matrix printer is as follows:
This will send output abc to dot matrix printer.
This had been done earlier by another developer and now I have to replace the dot matrix printer and send the same output to laser printer.
We are using Windows XP Service Pack 2. I installed HP LaserJet 1320 printer and captured LPT1 port as follows:
1. Opened the printer’s properties page
2. Selected the Sharing tab
3. Selected Share this printer radio button
4. Type hp3 in Share name box and clicked OK
5. Opened the command prompt and typed net use
6. This showed all the mappings that I currently have
7. Typed net use /delete lpt1
8. Typed the following on command prompt:
net use lpt1: \\computername\hp3 /persistent:yes
Now I run the asp application and gave \\computername\hp3 in printerlocation.asp page. Upon clicking the submit button, output abc appeared correctly on HP Laser Printer.
The issue that I am facing is that in printreceipt.asp, to output say 3 lines, carriage return and line feed characters have been used. For example, to output three lines to dot matrix printer, code would be as follows:
This would print three lines on dot matrix printer. But when I tried this code to see the output on HP Laser Printer, I got aaa on first page, bbb on second page and ccc on third page. I need to achieve LineFeed and Carriage Return on Laser Printer.
To accomplish dos based printing, dos based printing software is installed. Once this software is installed, the following line is written on printreceipt.asp page:
Code:
set dosprint=server.CreateObject("FastPrint.Writer")
When I type dosprint. I see two methods; WriteOnPrinter and PrinterClose. I also see one property; Printername.
So, a sample code to send output to dot-matrix printer is as follows:
Code:
set dosprint=server.CreateObject("FastPrint.Writer")
dosprint.Printername=printer1
call connect()
dosprint.WriteOnPrinter "abc"
Response.End
This will send output abc to dot matrix printer.
This had been done earlier by another developer and now I have to replace the dot matrix printer and send the same output to laser printer.
We are using Windows XP Service Pack 2. I installed HP LaserJet 1320 printer and captured LPT1 port as follows:
1. Opened the printer’s properties page
2. Selected the Sharing tab
3. Selected Share this printer radio button
4. Type hp3 in Share name box and clicked OK
5. Opened the command prompt and typed net use
6. This showed all the mappings that I currently have
7. Typed net use /delete lpt1
8. Typed the following on command prompt:
net use lpt1: \\computername\hp3 /persistent:yes
Now I run the asp application and gave \\computername\hp3 in printerlocation.asp page. Upon clicking the submit button, output abc appeared correctly on HP Laser Printer.
The issue that I am facing is that in printreceipt.asp, to output say 3 lines, carriage return and line feed characters have been used. For example, to output three lines to dot matrix printer, code would be as follows:
Code:
dosprint.WriteOnPrinter "aaa" & chr(10) & chr(13)
dosprint.WriteOnPrinter "bbb" & chr(10) & chr(13)
dosprint.WriteOnPrinter "ccc"
This would print three lines on dot matrix printer. But when I tried this code to see the output on HP Laser Printer, I got aaa on first page, bbb on second page and ccc on third page. I need to achieve LineFeed and Carriage Return on Laser Printer.