我正在使用ReportLab使用Python制作pdf.我想在画布上添加一个形状,并将该形状作为超链接.在以下示例中将矩形设为google.com的最简单方法是什么?
from reportlab.pdfgen import canvas
from reportlab.lib.units import inch
c = canvas.Canvas("hello.pdf")
# move the origin up and to the left, draw square
c.translate(inch,9*inch)
# How do I make this rectangle link to google.com?
c.rect(inch,inch,1*inch,1*inch, fill=1)
c.showPage()
c.save()
Run Code Online (Sandbox Code Playgroud)