如何在 Firefox 上打印条码 39

How to print barcode 39 on firefox

我曾尝试在 Firefox 上打印条码 39,在显示浏览器上显示了条码,但是当我想打印它时,条码不见了。然后我尝试 google chrome,一切正常。

这是我的代码:

@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;}

在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>

-谢谢

试试这个:

@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.

有关详细信息,请参阅 CSS3 Mediaqueries


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.

来源Print stylesheet - the definitive guide