Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Nov 10, 2021 8:03 am

Hi Supportteam,
I need to add a PdfUriAnnotation (because I need to set the with and height of the hyperlink ) to a PdfPageTemplateElement but it seems only possible in page and not in templates.
Any suggestion how I can accomplish this task?

Code: Select all
page.AnnotationsWidget.Add(new PdfUriAnnotation(new RectangleF(left, top, width, height), linkURL));

but how does it work in templates?

Greetings Christian

PrintPro
 
Posts: 55
Joined: Tue Apr 16, 2019 6:17 pm

Wed Nov 10, 2021 9:47 am

Hello Christian,

Thanks for your inquiry.
PdfPageTemplateElement is just an element that belongs to the page, and the annotations need to be added to the page structure. I'm sorry to tell you that we can't add PdfUriAnnotation to PdfPageTemplateElement. Would you mind telling me why you need to add PdfUriAnnotation to PdfPageTemplateElement? I might be able to provide you with some suggestions to help you accomplish your mission.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Wed Nov 10, 2021 7:23 pm

Hi Amy,
PdfUriAnnotation is required because i need to set the height and the width of the PdfUriAnnotation. PdfTextWebLink() would work but does not support height and width.
weblink.png

PrintPro
 
Posts: 55
Joined: Tue Apr 16, 2019 6:17 pm

Thu Nov 11, 2021 2:32 am

Dear Christian,

Thank you for your reply.
PdfTextWebLink object also needs to be added in Page, it is invalid when it is added in PdfPageTemplateElement. In fact, the PDF document itself does not contain the header and footer, the so-called header and footer are for drawing content at specified coordinates at the top/bottom of a page. Thus, you can draw PdfUriAnnotation at the top of the page to display as the document's header.
I hope you can understand.

Feel free to contact us if any questions.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF

cron