Printing the content of a frame
touch this button to download a PDF document the framed content.
For users
The frame might be hidden or visible but it will be content that needs to be printed, say a label or a report stripped of the surrounding context UI such as this.
For the scripters
We define the header and footer as usual but also define a large top margin. We know the server is using millimeters for margins, so we set 40mm.
<script src="/scripts/jquery-3.1.1.min.js"></script> <script src="/scripts/meadco.scriptX/meadco-scriptx-core-1.16.0.js"></script> <script src="/scripts/meadco.scriptX/meadco-scriptx-print-1.16.0.js"></script> <script src="/scripts/meadco.scriptX/meadco-scriptx-printhtml-1.16.0.js"></script> <script src="/scripts/meadco.scriptx/meadco-scriptxfactory-1.16.0.js"></script> <script src="/scripts/meadco-scriptx-1.10.1.js"></script> <script type="text/javascript"> 'use strict'; // a function for ux to show print in progress function spoolStatus(bEnable) { ... } $(window).on('load', function () { // connect to a print server MeadCo.ScriptX.Print.connect( "https://scriptx.print.meadroid.com", ""); $("#btn_printPage").click(function () { var settings = MeadCo.ScriptX.Print.HTML.settings; settings.header = "&b&bScriptX.Services :: Browser Agnostic Printing"; settings.footer = "&p of &P&b&b&d"; settings.page.margins.top = 40; MeadCo.ScriptX.Print.HTML.printFrame("infoframe"); spoolStatus(true); MeadCo.ScriptX.Print.waitForSpoolingComplete(-1, function(result) { spoolStatus(false); if ( typeof result === "string" ) alert("An error occurred while printing\n\n" + result); }); }); }); </script>