• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with printing a barcode from jsp  RSS feed

 
Raaja Gotluru
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am facing problem in priniting bar code from a jsp through barcode printer. The barcode sticker size is 4in x 4in. Whenever I call window.print() in jsp its trying to print a size of letter which is wasting three stickers. I want to set the the page size to 4x4 inches. How to do it? Somebody help me.

My code is:
<head>
<style media="print" type="text/css">
#printable { display: none; }
@media print
{
body * { visibility: hidden; }
#PrintDiv * { visibility: visible; }
#PrintDiv { position: absolute; top: 40px; left: 30px; }
#non-printable { display: none; }
#printable { display: block; }
@page{
size: 288px 288px;
}
}
</style>
</head>
<body>
<% String barcodegen = (String)request.getAttribute("barcode");%>

<div id="PrintDiv" style="visibility:hidden;page-break-after:always;width:10;
height:10" class="">
<p >
<object type="image/svg+xml" data="<%=barcodegen%>&ext=.svg" name="DynamicBarcode" ></object>

<% if(barcodegen!=null){ %>
<script>window.print();</script>

<% }%>
</p>
</div>
</body>
Help me in setting paper size.

--regards,
raaja
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!