문제

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)
도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top