Тема: HTA: Печать без вывода диалога
Есть вот такой HTA файл, который создает штрих-коды. Как отправить его на печать без диалога выбора принтера?
<html>
<hta:application id="bar_gen"
applicationname="Print bcodes"
contextmenu="yes"
innerborder="no"
maximizebutton="no"
minimizebutton="yes"
selection="no"
showintaskbar="yes"
singleinstance="yes"
sysmenu="yes"
SCROLL="no"
windowstate="normal"
ICON="cypher.ico"
>
<head>
<title>Генератор штрихкодов.</title>
<style>
* {
color:#000000;
font-family:Arial,sans-serif;
font-size:12px;
font-weight:normal;
}
#config{
overflow: auto;
margin-bottom: 10px;
}
.config{
float: left;
width: 200px;
height: 250px;
border: 1px solid #000;
margin-left: 10px;
}
.config .title{
font-weight: bold;
text-align: center;
}
.config .barcode2D,
#miscCanvas{
display: none;
}
#submit{
clear: both;
}
#barcodeTarget,
#canvasTarget{
margin-top: 1px;
}
</style>
<style type="text/css" media="print">
div.config {display: none; }
div.generator {display: none; }
div.submit {display: none; }
div.barcodeTarget {display: block; }
input {display: none; }
button {display: none; }
barcodeValue {display: none; }
generator {display: none; }
no_print {display: none; }
</style>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery-barcode-2.0.2.min.js"></script>
<script type="text/javascript">
self.resizeTo(670,200);
function goooo(){
window.print();
return( false );
}
function generateBarcode(){
var value = $("#barcodeValue").val();
var btype = $("input[name=btype]:checked").val();
var renderer = $("input[name=renderer]:checked").val();
var quietZone = false;
if ($("#quietzone").is(':checked') || $("#quietzone").attr('checked')){
quietZone = true;
}
var settings = {
output:renderer,
bgColor: $("#bgColor").val(),
color: $("#color").val(),
barWidth: $("#barWidth").val(),
barHeight: $("#barHeight").val(),
moduleSize: $("#moduleSize").val(),
posX: $("#posX").val(),
posY: $("#posY").val(),
addQuietZone: $("#quietZoneSize").val()
};
if ($("#rectangular").is(':checked') || $("#rectangular").attr('checked')){
value = {code:value, rect: true};
}
if (renderer == 'canvas'){
clearCanvas();
$("#barcodeTarget").hide();
$("#canvasTarget").show().barcode(value, btype, settings);
} else {
$("#canvasTarget").hide();
$("#barcodeTarget").html("").show().barcode(value, btype, settings);
}
}
function showConfig1D(){
$('.config .barcode1D').show();
$('.config .barcode2D').hide();
}
function showConfig2D(){
$('.config .barcode1D').hide();
$('.config .barcode2D').show();
}
function clearCanvas(){
var canvas = $('#canvasTarget').get(0);
var ctx = canvas.getContext('2d');
ctx.lineWidth = 1;
ctx.lineCap = 'butt';
ctx.fillStyle = '#FFFFFF';
ctx.strokeStyle = '#000000';
ctx.clearRect (0, 0, canvas.width, canvas.height);
ctx.strokeRect (0, 0, canvas.width, canvas.height);
}
$(function(){
$('input[name=btype]').click(function(){
if ($(this).attr('id') == 'datamatrix') showConfig2D(); else showConfig1D();
});
$('input[name=renderer]').click(function(){
if ($(this).attr('id') == 'canvas') $('#miscCanvas').show(); else $('#miscCanvas').hide();
});
generateBarcode();
});
</script>
</head>
<body style="margin: 0px">
<div id="generator">
<div class="generator"><br><center>
Цифры кода : <input type="text" id="barcodeValue" value="4600452017135"></center></div><br>
<div id="config">
<div class="config" style="display: none">
<div class="title">Тип кода</div>
<input type="radio" name="btype" id="ean13" value="ean13" checked="checked"><label for="ean13">EAN 13</label><br />
<br /><br />
</div>
<div class="config" style="display: none">
<div class="title">Настройки</div>
Цвет фона : <input type="text" id="bgColor" value="#FFFFFF" size="7"><br />
Цвет полосок : <input type="text" id="color" value="#000000" size="7"><br />
<div class="barcode1D">
Ширина: <input type="text" id="barWidth" value="1" size="3"><br />
Высота: <input type="text" id="barHeight" value="20" size="3"><br />
</div>
<div class="barcode2D">
Размер: <input type="text" id="moduleSize" value="10" size="3"><br />
Размер Quiet Zone: <input type="text" id="quietZoneSize" value="10" size="3"><br />
Форма: <input type="checkbox" name="rectangular" id="rectangular"><label for="rectangular">Rectangular</label><br />
</div>
<div id="miscCanvas">
x : <input type="text" id="posX" value="10" size="3"><br />
y : <input type="text" id="posY" value="20" size="3"><br />
</div>
</div>
<div class="config" style="display: none">
<div class="title">Печать</div>
<input type="radio" id="css" name="renderer" value="css" checked="checked"><label for="css">CSS</label><br />
<input type="button" onclick="goooo();" value=" Печать штрихкода ">
</div>
</div>
<div id="submit">
<br><center><b><input type="button" onclick="generateBarcode();" value=" Генерация штрихкода "></b><center>
</div>
<br>
</div>
<span id="B_text" style="font-size: 7px; font-family: Verdana;"></span>
<div id="barcodeTarget" class="barcodeTarget"><br></div>
<canvas id="canvasTarget" width="150" height="150"></canvas>
</body>
</html>
Пробовал InternetExplorer.Application - не получилось ничего. Какие еще есть ходы?

