繁体   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