Javascript uses scriptx for Printing

Source: Internet
Author: User

After searching and querying on the internet, finding this plug-in is more practical, but it is basically easy to write on the network. Most of them belong to replication. There is not much explanation. In order to avoid detours, we hereby record

Scriptx is a paid plug-in with rich printing functions.

Basic functions are free of charge, and advanced functions are charged. Generally, basic functions are sufficient.

Usage

Write the control reference under the head tab of the page.Code

< Object ID = "Factory" Style = "Display: none" Classid = "CLSID: 1663ed61-23eb-11d2-b92f-008048fdd814"
Codebase = "Scriptx. Cab" Viewastext >
</ Object >

Write JavaScript code. I just want to give a simple column. The attributes are listed below.

Function Preview (){
Factory. Printing. Preview (); // Browse
}

Then, you can use a button to call this js method to implement simple printing and complex printing. You need to decide based on your actual situation.

< Input Type = "Button" Value = "Preview and print" Onclick = "Preview ()" ID = "Button1" Name = "Printbtn" >

 

The following section lists some attributes of the control.

// ----------------- Basic functions, free use -----------------------
Factory. Printing. header = ""; // Header
Factory. Printing. footer = ""; // Footer
Factory. Printing. setmarginmeasure (1 ); // The page margin unit is 1 (mm) and 2 (INCHES). You must note that most printers cannot print the margins without any margins, that is, the minimum margin is 6mm or more.
// 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. Whether to print horizontally is false.
// ------------------ Advanced functions ---------------------------------------------
Factory. Printing. Printer = "Epson LQ-1600KIII "; // Printer used
// Factory. Printing. Printer = "\\\\ cosa-data \ hhaserj"; // escape characters if the printer is a network printer.
Factory. Printing. papersize = "A4 "; // Used paper
Factory. Printing. papersource = "manual feed "; // Paper Feed method. Here is manual paper feed.
Factory. Printing. Copies = 1; // Print copies
Factory. Printing. printbackground = False ; // Print background image?
Factory. Printing. setpagerange ( False , 1, 3 ); // Print 1 to 3 pages
// --------------------- Common functions --------------------------------
Factory. Printing. Print ( False ); // No confirmation printing. If it is true, confirmation is required before printing.
Factory. Printing. printsetup (); // Print settings
Factory. Printing. Preview (); // Print preview
Factory. Printing. waitforspoolingcomplete (); // It is useful when the previous print task is completely sent to the print pool without confirmation
Factory. Printing. enumprinters (INDEX ); // Enumeration of all installed printers, mainly used to generate printer Selection

 

 

Related Article

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.