Comments (6)
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.
@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.
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.
I can take a shot at that if you'd like!
from python-barcode.
Give it a shot if you like; it'll be a while before I can address this myself.
from python-barcode.
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)
- How to use with Pillow image
- ISBN-13 starting with 979 HOT 1
- Text placement in ImageWriter HOT 2
- UPC/UPCA final output doesn't include guard bars HOT 1
- Add some form of tests reading the barcodes
- no support for MSI (Plessey) barcodes HOT 2
- EAN13 calculate_checksum() generates inconsistent values HOT 6
- better formating for GS1_128 HOT 1
- Unable to generate PNG using pillow 10 HOT 3
- dpi HOT 1
- generating barcode error HOT 1
- Unexpected ">" symbol at the end of generated EAN-13 barcode HOT 2
- module_width not working HOT 1
- invalid ppem value with 0.15.1 but not with 0.14.0 HOT 5
- Incompatibility with pillow 10.0.1 HOT 10
- Error on the number generated HOT 11
- Redable text under bars is cut out from the image HOT 2
- Support for Code128 FNC4 / ISO-8859-1
- Why does `Barcode.build()` always return a singleton list? HOT 2
- GS1-128 images are cut-off HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-barcode.