-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPrintAndWaitInWindowError.html
More file actions
164 lines (139 loc) · 6.97 KB
/
PrintAndWaitInWindowError.html
File metadata and controls
164 lines (139 loc) · 6.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<html>
<head>
<link rel="stylesheet" type"text="" css"="" href="display.css">
<link rel="stylesheet" type"text="" css"="" href="print.css" media="print">
<title>MeadCo's ScriptX</title>
<style type="text/css">
html, body {
font-family: Segoe,Lucida Grande,Lucida Sans,Verdana,sans-serif;
margin: 24px;
}
.button-bar {
margin-top: 12px
}
@media print {
.button-bar {
display: none;
}
}
</style>
</head>
<body>
<!-- MeadCo Security Manager : Ignored in modern browsers -->
<!-- NOTE: A codebase would usually be included. -->
<!-- The evaluation GUID is subject to change -->
<object id="secmgr" viewastext style="display:none"
classid="clsid:5445be81-b796-11d2-b931-002018654e2e">
<param name="GUID" value="{370000ED-D40C-43D4-B3D3-F2E7D2EFF47D}" />
<param name="PATH" value="https://licenses.meadroid.com/download/{370000ED-D40C-43D4-B3D3-F2E7D2EFF47D}/mlf" />
<param name="REVISION" value="0" />
<param name="PerUser" value="true">
</object>
<!-- MeadCo ScriptX : Ignored in modern browsers -->
<object viewastext id="factory" style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>
<h1>MeadCo's ScriptX :: Any browser</h1>
<div style="font-size: 14pt; line-height: 22pt;">
For nearly 20 years MeadCo's ScriptX - now installed on many millions of Windows PCs - has
enabled document authors to script print-time attributes such as margin sizes, orientation,
HTML & standard headers and footers, paper source, target printer, prompt-free printing and much more ...
</div>
<!-- new UI -->
<div class="button-bar">
<button id="btn-print" class="btn btn-primary">Print and close</button>
</div>
<!-- scriptx.services compatibility requires jquery 3 -->
<script src="//cdn.jsdelivr.net/npm/jquery@3/dist/jquery.min.js"></script>
<!-- Exemplar dialogs require Bootstrap 3.3 or 4.x. Use compiled and minified CSSc and javascript -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<!-- For async, a promise library is required for IE 11.
We use and test with promise-polyfill.
see https://github.com/taylorhakes/promise-polyfill
-->
<script src="//cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.min.js"></script>
<!-- Helper library to obscure differences between .Addon and .Services
see https://github.com/MeadCo/MeadCoScriptXJS
-->
<!-- Use of this code is indicated by use of MeadCo.ScriptX and MeadCo.ScriptX.Printing prefixes -->
<!-- Please note that the library must be initialised - it does not auto initialise -->
<script src="//cdn.jsdelivr.net/npm/meadco-scriptxjs@1/dist/meadco-scriptx.min.js"></script>
<!-- javscript Add.on to Scriptx.Services compatibility -->
<!-- Connect to ScriptX.Services for Windows PC -->
<!-- Use the same evaluation GUID - it is subject to change -->
<script src="//cdn.jsdelivr.net/npm/scriptxprint-html@1/dist/meadco-scriptxservicesUI.min.js"
data-meadco-server="http://localhost:41191"
data-meadco-license="{370000ED-D40C-43D4-B3D3-F2E7D2EFF47D}"
data-meadco-license-path="warehouse"
data-meadco-license-revision="0"
data-meadco-syncinit="false">
</script>
<!-- leave current script as is, it will work .. to minimise effort -->
<script>
function initView() {
factory.printing.enhancedFormatting.allPagesHeader =
"<div><center><img src='http://services.meadroid.com/images/sx-header.png'></center></div>";
factory.printing.enhancedFormatting.allPagesFooter =
"<div><center><img src='http://services.meadroid.com/images/sx-footer-final.png'></center></div>";
factory.printing.SetMarginMeasure(2) // set inches
factory.printing.header = ""
factory.printing.footer = ""
factory.printing.leftMargin = 0.75
factory.printing.topMargin = 1.5
factory.printing.rightMargin = 0.75
factory.printing.bottomMargin = 1.5
}
</script>
<!-- enable detailed logging -->
<script type="text/javascript">
console.log(">>> Page script starting");
// If ScriptX.Services client libraries have been loaded enable some more verbose logging for debugging purposes
if (typeof MeadCo === "object") {
console.log("enable verbose logging in ScriptX.Services");
MeadCo.logEnabled = true;
}
// If ScriptX.Services client libraries have been loaded then overload the error report functions
// to use the error reporting code for this application (for demonstration, we use simple javascript alert).
if (typeof MeadCo === "object" && typeof MeadCo.ScriptX === "object" && typeof MeadCo.ScriptX.Print === "object") {
// overload cloud print library report error
MeadCo.ScriptX.Print.reportServerError = function (errorTxt) {
console.error(errorTxt);
alert("An error has occured in ScriptX.Services:\n\n" + errorTxt);
}
MeadCo.ScriptX.Print.reportFeatureNotImplemented = function (featureDescription) {
var msg = "Sorry " + featureDescription +
" is not available yet with ScriptX.Services."
console.warn(msg);
alert(msg);
}
}
</script>
<!-- new UI script -->
<script type="text/javascript">
$(window).on("load", function () {
console.log("Start view");
MeadCo.Licensing.IsLicensedAsync()
.then(function (l) {
MeadCo.ScriptX.InitAsync()
.then(function () {
initView();
$("#btn-print").click(function () {
MeadCo.ScriptX.PrintPage2(true).then(function (printStarted) {
if (printStarted) {
self.close();
}
});
});
})
.catch(function (e) {
reportError("Unable to initialise ScriptX: " + e)
});
})
.catch(function (e) {
reportError("Unable to use ScriptX License: " + e)
});
});
</script>
</body>
</html>