Pregunta

I am using a Django app in order to generate a PDF with reportlab which includes an oxxo barcode, but I get the following error:

Can not open resource "https://www2.oxxo.com:

My code is

p.drawImage(url,PAGE_WIDTH/2.0-120,380)
¿Fue útil?

Solución

From Reportlab documentation for drawImage -

drawImage(image, x, y, width=None, height=None, mask=None, preserveAspectRatio=False, anchor='c')

    Draws the image (ImageReader object or filename) as specified.

    “image” may be an image filename or an ImageReader object.

image can certainly not be an url. You can download the image in a local file and include that file's path as the value of first parameter image.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top