Git Product home page Git Product logo

Comments (6)

WhyNotHugo avatar WhyNotHugo commented on June 18, 2024

You probably want the render method, rather than raw:

def get(self, request, *args, **kwargs):
    uuid = request.GET.get('uuid')
    C39 = barcode.get_barcode_class('code39')
    toserve = C39(uuid)
    return HttpResponse(toserve.render(), content_type="image/svg+xml")`

from python-barcode.

sharifanani avatar sharifanani commented on June 18, 2024

@WhyNotHugo .render() method 'requires' a positional argument (which I did not get how to specify from the docs), .render attribute gives the same empty result as I showed previously

UPDATE
Found the correct documentation here.

I did notice that the default should be None as shown in the declaration, but it doesn't seem to let the function execute correctly. Should I update the SVG writer to use {'compress: False} by default? I am a big fan of the library and would like to contribute

from python-barcode.

WhyNotHugo avatar WhyNotHugo commented on June 18, 2024

raw is actually an ugly side effect of poor code (it's actually removed in the latest master, and was actually buggy).

I'm thinking about reintroducing a raw property, which returns the raw barcode properly (rather than write it) for situations like this.

from python-barcode.

sharifanani avatar sharifanani commented on June 18, 2024

I can take a shot at that if you'd like!

from python-barcode.

WhyNotHugo avatar WhyNotHugo commented on June 18, 2024

Give it a shot if you like; it'll be a while before I can address this myself.

from python-barcode.

WhyNotHugo avatar WhyNotHugo commented on June 18, 2024

Given that render already returns the rendered barcode, and seems to suffer no limitations, I think it's okay to close this.

Don't hesitate to leave a reply if you consider there's something I might have overlooked here.

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.