3
我正在使用ReportLab使用Python制作pdf。我想在画布上添加一个形状,并将该形状用作超链接。以下示例中的矩形链接到google.com的最简单方法是什么?在ReportLab中将超链接添加到画布元素的最简单方法是什么?
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()
最有可能@MartjinPieters不知道其他两个答案突出了问题。请参阅Crebits对修正方法的回答。 –
@fatih_dur:谢谢你的提醒,我确实没有意识到其他帖子。 –