Use the scriptx Control for web printing ASP printing (source code)

Source: Internet
Author: User

Use the scriptx Control for web printing ASP printing (source code)

 

Recently started a small projectProgramTo precisely control the position of web printing, ie's printing function is basically half-disabled, so it cannot be customized or printed directly, in addition, due to the browser version or operating system settings, the most basic margin settings may be incorrect. In short, printing has becomeWebThe biggest difficulty of the program, so useActiveXControl printing is the best solution, but the current price of controls is tens of thousands. Fortunately, there are still two free options. One is that the windows system has webbrowser. execwb control, but this is not easy to use due to system security settings restrictions. Second, use a third-party control scriptx (Http://www.meadroid.com/scriptx/), Basic scriptx functions are free of charge, but advanced functions are charged. Next I will summarize my recent experiences in using scriptx in projects. For more details, see the official manual:Http://www.meadroid.com/scriptx/docs/printdoc.htm. leave the source code for email in the comments.

Note: scriptx cracking is not easy to find. If you need a scriptx cracked version, please leave your email
Because it is a cracked version, there is no electronic signature, you need to add the site to the trusted site, and modify some security rules

Note: An error occurred while sending the attachment. Now it is transferred to the csdn space:Http://download.csdn.net/source/558406

Easy to use:
Introduce the control to the page head:
<Object ID = factory viewastext style = "display: none"
Classid = "CLSID: 1663ed61-23eb-11d2-b92f-008048fdd814"
Codebase = "scriptx. Cab # version = 6, 3, 435,20">
</Object>
Set print parameters:

<SCRIPT defer>
// ------------------- Basic functions, free use -----------------------
Factory. Printing. header = "" ; // Header
Factory. Printing. footer = "" ; // Footer

Factory. Printing. setmarginmeasure ( 1 ); // The margin unit. The value 1 indicates millimeters and the value 2 indicates inches.
// Margin settings. Note that most printers cannot print at any margin, that is, there is a minimum margin, which is generally more than 6mm.
// If it is set to zero when the margin is set, it is automatically adjusted to its minimum margin.
Factory. Printing. leftmargin = 7 ; // Left margin
Factory. Printing. topmargin = 7 ; // Top margin
Factory. Printing. rightmargin = 7 ; // Right margin
Factory. Printing. bottommargin = 7 ; // Bottom margin

Factory. Printing. Portrait = True ; // Whether to print vertically or not, and whether to print horizontally is false

// -------------------- Advanced functions ---------------------------------------------

Factory. Printing. Printer = EPSON LQ-1600KIII" ; // Specify the printer used
// Factory. Printing. Printer = "// cosa-data // maid"; // escape a character if it is a network printer
Factory. Printing. papersize = "A4"; // specify the used paper
Factory. Printing. papersource = "Manual feed" ; // Paper feed method. Here is manual paper feed.
Factory. Printing. Copies = 1 ; // Print the number of copies
Factory. Printing. printbackground = False ; // Whether to print the background image
Factory. Printing. setpagerange ( False , 1 , 3 ); // Print 1 to 3 pages

// --------------------- Common functions --------------------------------
Factory. Printing. Print ( False );// No confirmation is printed. If it is true, confirmation is required before printing.
Factory. Printing. printsetup (); // Print settings
Factory. Printing. Preview (); // Print and preview
Factory. Printing. waitforspoolingcomplete (); // Wait until the previous print task is completely sent to the print pool, which is very useful in the continuous printing without confirmation
Factory. Printing. enumprinters (INDEX ); // Enumerate all installed printers, mainly used to generate the printer Selection Function
</SCRIPT>
Example
It cannot be used because the control is intercepted and allowed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.