Coder Social home page Coder Social logo

Comments (9)

QuickLearner171998 avatar QuickLearner171998 commented on May 29, 2024 8

Just write these lines before your code

    from barcode.base import Barcode
    Barcode.default_writer_options['write_text'] = False

from python-barcode.

crowdawg avatar crowdawg commented on May 29, 2024 3

Hello, I came across this issue by reading the documentation as well but eventually discovered by looking at the source that there is in fact an option called write_text=True in the base writer options.

You should update your documentation so people know it exists.

Keep up the good work

from python-barcode.

WhyNotHugo avatar WhyNotHugo commented on May 29, 2024 1

Ideally, this should be exposed as a flag that both the ImageWriter and SVGWriter expose.

Until I get a change to implement that, as a hack, you can use this writer:

class ImageWitoutTextWriter(ImageWriter):
    def _paint_text(self, xpos, ypos):
        pass

from python-barcode.

tokt avatar tokt commented on May 29, 2024

Hello! How do you run the command? For example:

  • python-barcode create "123456789000" outfile -b ean
    will generate barcode without any text.

from python-barcode.

nabelekt avatar nabelekt commented on May 29, 2024

It looks like this is a duplicate of #24. @WhyNotHugo, would you accept a PR with the code given there?

from python-barcode.

NatanBudny avatar NatanBudny commented on May 29, 2024

Ideally, this should be exposed as a flag that both the ImageWriter and SVGWriter expose.

Until I get a change to implement that, as a hack, you can use this writer:

class ImageWitoutTextWriter(ImageWriter):
    def _paint_text(self, xpos, ypos):
        pass

Works for me! God Bless You, I really Thank you!
I look a lot for something like that, you solved it easily. I still don't understand how it works, but it solved my big problem :D

from python-barcode.

NatanBudny avatar NatanBudny commented on May 29, 2024

Pra quem procura algo em português, esse é meu código que gera a imagem sem o texto do código de barras:

from barcode.writer import ImageWriter

class ImageWitoutTextWriter(ImageWriter):
    def _paint_text(self, xpos, ypos):
        pass

ean = barcode.get('ean13', '123456789102', writer=ImageWitoutTextWriter())
filename = ean.save('ean13')
filename
'ean13.png'


from python-barcode.

ahmedtouahria avatar ahmedtouahria commented on May 29, 2024

from barcode.base import Barcode Barcode.default_writer_options['write_text'] = False
its works

from python-barcode.

WhyNotHugo avatar WhyNotHugo commented on May 29, 2024

Closing as dupe of #24. PRs welcome.

from python-barcode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.