Weasyprint: How to insert a Bar Code in WeasyPrint?

Created on 25 Oct 2018  Â·  7Comments  Â·  Source: Kozea/WeasyPrint

Dear good afternoon, I am trying to create a bar code in WeasyPrint and I have looked for examples or guides to do it and I did not find anything.

Can you help me please? I show you an example of a reportLab:

if code_payment_facil:
barcode = code128.Code128 (easy_payment_code, barHeight = 30, barWidth = 1)
barcode.drawOn (p, 120 * mm, 260 * mm)
p.setFont ('Times', 8)
code_pago_facil_2 = ''
for c in codigo_pago_facil:
code_pago_facil_2 + = str (c) + ""
p.drawString (370, 730, code_payment_facil_2)

This I would like to be able to pass it to WeasyPrint.

I await answers.

Regards Dear,

CSS question

Most helpful comment

Hello,

Please don't write "PLEASE HELP" in your issue title: it will not make people give you quicker answers, it will just be annoying for people trying to help you. We already know that you need help, that's often why people open issues :wink:.

I have looked for examples or guides to do it and I did not find anything.

There's a samples page on the website, and among the presented features you'll find … a barcode!

The barcode number is in the HTML file and is automatically transformed into a barcode thanks to a font.

All 7 comments

Hello,

Please don't write "PLEASE HELP" in your issue title: it will not make people give you quicker answers, it will just be annoying for people trying to help you. We already know that you need help, that's often why people open issues :wink:.

I have looked for examples or guides to do it and I did not find anything.

There's a samples page on the website, and among the presented features you'll find … a barcode!

The barcode number is in the HTML file and is automatically transformed into a barcode thanks to a font.

@robertonqn Is that OK for you?

Good morning, I tell you that this bar code did not work for me, I am trying to find another type of source that is Code128, since the source of google code128 would not be working on my system.

so if you have any other idea I would appreciate it.

If you really want to use the code128 module, then use it to generate an image with something like

with open("Hello World.svg", "w") as f:
    f.write(code128.svg("Hello World"))

and include this SVG image in your HTML file.

@robertonqn Can I close this issue?

Can I close this issue?

Let's say I can.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

amarnav picture amarnav  Â·  5Comments

Tontyna picture Tontyna  Â·  4Comments

antuaneacion picture antuaneacion  Â·  3Comments

ajakubo1 picture ajakubo1  Â·  5Comments

bjornasm picture bjornasm  Â·  3Comments