Controlling margins, printing and previewing frames

In an international environment there may be a mixture of margin measurement units. ScriptX enables the developer to specify the margin units they wish to use, either mm or inches and use those units irrespective of the users default measurement system.

To illustrate this this sample has set the margins using the opposite units to your default of .

const printer = MeadCo.ScriptX.Printing;
printer.header = "Frame print sample - inches";
printer.footer = "Printing by ScriptX - inches";
printer.SetMarginMeasure(2); // set inches
printer.leftMargin = 0.5;
printer.topMargin = 0.5;
printer.rightMargin = 0.5;
printer.bottomMargin = 0.5;
printer.copies = 1;
                
const printer = MeadCo.ScriptX.Printing;
printer.header = "Frame print sample - mm";
printer.footer = "Printing by ScriptX - mm";
printer.SetMarginMeasure(1); // set mm
printer.leftMargin = 12.5;
printer.topMargin = 12.5;
printer.rightMargin = 12.5;
printer.bottomMargin = 12.5;
printer.copies = 1;
                

The new margins and measure can be seen in

To print or preview an iframe we pass the name of the frame to the Print() or Preview() functions.

 

For example, using the MeadCo ScriptX Javascript library:

document.getElementById("btn-print").addEventListener("click", () => { 
    MeadCo.ScriptX.PrintFrame("infoframe", false); 
});
            
document.getElementById("btn-preview").addEventListener("click",() => { 
    MeadCo.ScriptX.PreviewFrame("infoframe"); 
});