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:謝謝你的提醒,我確實沒有意識到其他帖子。 –