• Home > Web Front-end > JS Tutorial > body text

    JavaScript printing encyclopedia (print page settings/print preview code)_javascript skills

    WBOY
    Release: 2016-05-16 17:39:01
    Original
    1878 people have browsed it
    Copy code The code is as follows:

    javascript print- Print page settings - print preview code





    classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 name=wb>







    javascript print Encyclopedia
    (1)
    Copy code The code is as follows:

    < script. defer>
    function SetPrintSettings() {
    // -- advanced features
    factory.printing.SetMarginMeasure(2) // measure margins in inches
    factory.SetPageRange(false, 1, 3 ) // need pages from 1 to 3
    factory.printing.printer = "HP DeskJet 870C"
    factory.printing.copies = 2
    factory.printing.collate = true
    factory.printing. paperSize = "A4"
    factory.printing.paperSource = "Manual feed"
    // -- basic features
    factory.printing.header = "This is MeadCo"
    factory.printing.footer = "Advanced Printing by ScriptX"
    factory.printing.portrait = false
    factory.printing.leftMargin = 1.0
    factory.printing.topMargin = 1.0
    factory.printing.rightMargin = 1.0
    factory .printing.bottomMargin = 1.0
    }


    (2)
    Copy code The code is as follows:


     function printsetup(){
     //Print page setup
     wb. execwb(8,1);
     }
    Function printpreview(){
    // Print page preview
    wb.execwb(7,1);
    }
    function printit()
     {
     if (confirm('Are you sure to print? ')) {
    wb.execwb(6,6)
     }
     }
     


    < ;OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
    height=0 id=wb name=wb width=0>
    onclick="javascript.:printit()">
    onclick="javascript.:printsetup( );">
    onclick="javascript.:printpreview();">
    onclick="javascript.:window.close();">

    ----------------- -------------------------------
    There are other uses for this component, listed below:
    WebBrowser.ExecWB(1,1) Open
    Web.ExecWB(2,1) Close all current IE windows and open a new window
    Web.ExecWB(4,1) Save the web page
    Web.ExecWB(6,1) Print
    Web.ExecWB(7,1) Print Preview
    Web.ExecWB(8,1) Print Page Settings
    Web.ExecWB(10,1) View the page properties
    Web.ExecWB(15,1) It seems to be revoked and needs to be confirmed
    Web.ExecWB(17,1) Select all
    Web.ExecWB(22,1) Refresh
    Web. ExecWB(45,1) Close the form silently
    2. Print in pages
    Copy code The code is as follows: