Printing barcode labels from a web page

前端 未结 10 1263
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 18:48

I am working on an ASP.Net web application that must print dynamically created labels on standard Avery-style label sheets (one particular size, so only one overall layout).

相关标签:
10条回答
  • 2020-12-09 19:28

    I had a similiar issue and the answer is you can't do it. Instead, I generated a PDF file in realtime using iTextSharp and passed that to the response.

    0 讨论(0)
  • 2020-12-09 19:31

    The web is not a format that is guaranteed to get consistent print results. Given the standard support for label printing with MS Word, and the relative ease of automation and generation, I would strongly recommend going that route.

    I'm not aware of ANY method to get percise printing across all types of browsers, operating systems, and printers when using web content.

    0 讨论(0)
  • 2020-12-09 19:34

    Forget HTML and make a PDF. HTML printing is extremely variable - not just across browsers but across different versions of the same browser. PDF is a lot easier.

    Even if you get it exactly right with one browser / font setup / printer / phase of the moon, it will be the most fragile thing you've ever had to maintain. No matter how long you think it will take to make a PDF (and it's not really that hard as there are some free libraries out there), HTML will ultimately take a lot more of your time. PDF readers are widely deployed and print more consistently than even Word files.

    0 讨论(0)
  • 2020-12-09 19:37

    I rewrote the SharpPDFLabel code that was mentioned back in 2011 this week as I needed it to be a lot more flexible (and to work with the current iTextSharp library).

    You can get it here: https://github.com/finalcut/SharpPDFLabel

    I added the ability to specify the contents of each individual label if you want (or to continue creating a sheet of identical labels too). By extending the LabelDefinition class you can specify the layout of your labels pretty easily.

    0 讨论(0)
提交回复
热议问题