Results 1 to 2 of 2
  1. #1
    g.raaja is offline Member
    Join Date
    Dec 2009
    Posts
    8
    Rep Power
    0

    Default problem with printing a barcode from jsp

    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

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    This has nothing to do with JSPs and everything to do with javascript and the printing mechanism associated with that.
    You might do better on a javascript forum?

Similar Threads

  1. Problem in printing
    By justbeller in forum Java 2D
    Replies: 0
    Last Post: 04-26-2011, 03:48 PM
  2. Replies: 0
    Last Post: 03-01-2011, 08:57 AM
  3. Replies: 0
    Last Post: 09-16-2010, 12:54 PM
  4. Printing problem
    By justlynn in forum NetBeans
    Replies: 5
    Last Post: 08-03-2010, 03:41 PM
  5. printing problem
    By ntpl in forum AWT / Swing
    Replies: 0
    Last Post: 11-27-2007, 12:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •