簡體   English   中英

在 ReportLab PDF 中包含遠程圖像

[英]Including a remote image in ReportLab PDF

我正在使用 Django 應用程序生成包含 oxxo 條形碼的 reportlab 的 PDF,但出現以下錯誤:

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

我的代碼是

p.drawImage(url,PAGE_WIDTH/2.0-120,380)

來自drawImage Reportlab 文檔-

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當然不能是網址。 您可以將圖像下載到本地文件中,並包含該文件的路徑作為第一個參數image的值。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM