我正在使用Python中的ReportLab制作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()