Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing the webform...

Status
Not open for further replies.

Sidrp

IS-IT--Management
Jun 4, 2003
44
US
Hi Everyone...
Heres a situation I need to resolve. I have a web form which the user fills up. I want to save the information in a database, but before that I need to print the form exactly like its seen on the screen. I do not want to use the Client side printing as I need to use the Duplex feature of my printer to print some other data on the back of this printed form. Any suggestions..I have tried looking everywhere but the only solutions I find is to use the javascript's print function. I donot want this, I want to be able to print from ASP.net..
Thanks
Sid
 
You can't. What the user see's is, by definition, client-side. If you COULD print server-side, it would print on a printer attached to your web server.

To print on a client's printer, you have to print client-side, and that means JavaScript's "window.print()".

I work in the graphic arts industry. When it's crucial to deliver an exact layout, I generate a PDF. PDF's have their own JavaScript engine, which allows for silent printing.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Thanks Thomas..
So since we can not do what I want waht options do I have? I still want to be able to use the duplex mode of the printer to print on the other side of the sheet, that is crucial. Can we do that with PDF? How does it work..give me some idea..
thanks
Sid
 
From the Acrobat JavaScript reference manual:

print

Prints all or a specific number of pages of the document.
Beginning wtih Acrobat 6.0, the method can print the document using the settings contained in a printParams Object, rather than through the other parameters. The
permanent print settings are not altered.

NOTES: (Security, version 6.0) When printing to a file,
the path must be a Safe Path. The print method will not overwrite an existing file On a Windows platform, the file name must include an extension of .ps or .prn (case insensitive). Additionally, the print method will not create a file directly in the root directory, the windows directory, or the windows system directory.

An InvalidArgsError (see the Error Objects) exception will be thrown and print wiill fail if any of the above security restrictions are not met.

Parameters

bUI (optional)
If true (the default), will cause a UI to be presented to
the user to obtain printing information and confirm the action.

nStart (optional
A 0-based index that defines the start of an inclusive
range of pages. If nStart and nEnd are not specified, prints all pages in the document. If only nStart is specified then the range of pages is the single page specified by nStart.
If nStart and nEnd parameters are used, bUI must be false.


nEnd (optional)
A 0-based index that defines the end of an inclusive range of page. If nStart and nEnd are not specified, prints all pages in the document. If only nEnd is specified then the range of a pages is 0 to nEnd. If nStart and nEnd parameters are used, bUI must be false.

bSilent (optional)
If true, suppresses the cancel dialog box while the document is printing. The default is false

bShrinkToFit (optional, version 5.0)
If true, the page is shrunk (if necessary) to fit within the imageable area of the printed page. If false, it is not. The default is false.

bPrintAsImage (optional, version 5.0)
If true, print pages as an image. The default is false.

bReverse (optional, version 5.0)
If true, print from nEnd to nStart. The default is false.

bAnnotations (optional, version 5.0)
If true (the default), annotations are printed.

printParams (optional, version 6.0)
The printParams Object containing the settings to use for printing. If this parameter is passed, any other parameters are ignored.

Example:

Code:
this.print(false, this.pageNum, this.pageNum);
// print a file silently
this.print({bUI: false, bSilent: true, bShrinkToFit: true});

Sorry, I don't see anything in there regarding "Duplex" printing.

Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top