Avery Dennison Platinum 6039 JavaScript User Manual

Page 14

Advertising
background image

2-2 Programmer’s Manual

Within your application, instantiate the Printer and Scanner classes such
as Printer and call a method such as Print when you need to print.

Example

<html>

<head>

<title>OnDemand</title>

<script

src="./jsUltra.js"></script>

<script type="text/javascript" language="javascript">

function print() {

var fmt = "{F,1,A,R,E,200,200,\"UPCA\"|

C,150,49,0,50,8,8,A,L,0,0,\"M06039 Platinum\",1|

B,1,12,F,25,28,1,4,100,7,L,0|
T,2,22,V,133,1,0,1,1,1,O,C,0,0|}"

}

Printer.ClearSystemError();

// Clear any errors

if (!Printer.IsBatteryOKToPrint)

// Check Battery

alert("Low Battery");

else {

PRINTER.Print = fmtUPCA;
PRINTER.Print = "{B,1,N,1|E,0,0,1,1,0,1|
PRINTER.Print = 1,\"" + txtUPC.Print + "\"|}";

}

</SCRIPT>

<body onsubmit="print()">

<object id="PRINTER" style="LEFT: 0px; WIDTH: 0px; TOP:

0px; HEIGHT: 0px"

classid="clsid:19c1754d-ba97-43a1-a06d-496d2167400b">

</object>

</body>

This example prints the data stored in the fmtUPCA string and the data
stored in the txtUPC.Print field. The PRINTER.Print lines contain the
batch data.

Advertising