Search code examples
csssvgfontscoldfusion-11

How to print barcode 39 on firefox


i have try to print barcode 39 on firefox, on display browser it the barcode was appear, but when i want to print this, the barcode was gone. then i try on google chrome, everything was okay.

this is my code :

@font-face {
font-family:"Barcode 39";
src:url("/web/res/css/font/Code39.eot?") format("eot"),url("/web/res/css/font/Code39.woff")
format("woff"),url("/web/res/css/font/Code39.ttf") 
format("truetype"),url("/web/res/css/font/Code39.svg#")
format("svg");
font-weight:normal;font-style:normal;}

at html :

<style media="screen" type="text/css">/*<![CDATA[*/@import '/web/task/local/adhi/fontbarcode.css';/*]]>*/</style>
<style type="text/css">
    .code39{
        font-family:"Barcode 39";
        font-size :50px;
    }
</style>


<span class="code39">*1234*</span>
<br><br>

-Thanks


Solution

  • Try this:

    @media screen { 
        .code39{
            font-family:"Barcode 39";
            font-size :50px;
        }
    }
    @media print { 
        .code39{
            font-family:"Barcode 39";
            font-size :50px;
        }
    }
    

    The @media rule, introduced in CSS2, made it possible to define different style rules for different media types.

    Examples: You could have one set of style rules for computer screens, one for printers, one for handheld devices, one for television-type devices, and so on.

    See CSS3 Mediaqueries for more informations.


    A print stylesheet formats a web page so when printed, it automatically prints in a user-friendly format. Print stylesheets have been around for a number of years and have been written about a lot. Yet so few websites implement them, meaning we're left with web pages that frustratingly don't properly print on to paper.

    It's remarkable that so few websites use print stylesheets as:

    • Print stylesheets enormously improve usability, especially for pages with a lot of content (such as this one!)

    • They're phenomenally quick and easy to set up

    Some websites do offer a link to a print-friendly version of the page, but this of course needs to be set up and maintained. It also requires that users notice this link on the screen, and then use it ahead of the regular way they print pages (e.g. by selecting the print button at the top of the screen). Print-friendly versions are however useful when printing a number of web pages at the same time such as an article that spans on to several web pages.

    Source Print stylesheet - the definitive guide