Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with printing a barcode from jsp  RSS feed

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

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:
<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; }
size: 288px 288px;
<% 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){ %>

<% }%>
Help me in setting paper size.

With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!