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 Feb 02, 2022 4:11 pm

Hello,

I'm using PdfTextWebLink to add a hyperlink on existing pdf documents. Everything is working fine but I'd like to apply custom color to the text. I'm only able to set the text color via setting the Brush property and assigning by one of the predefined colors in PdfBrushes.

Here is my code:
Code: Select all
var headerPdfTextWebLink = new PdfTextWebLink();
headerPdfTextWebLink.Text = headerText;
headerPdfTextWebLink.Url = headerLink;
headerPdfTextWebLink.Font = font;
headerPdfTextWebLink.Brush = PdfBrushes.DodgerBlue;
headerPdfTextWebLink.DrawTextWebLink(page.Canvas, new PointF(2, 2));



Can you please let me know if it is possible at all to set custom color and how ?

Thanks in advance,
Shehim

Shefketov
 
Posts: 2
Joined: Wed Feb 02, 2022 4:00 pm

Thu Feb 03, 2022 7:34 am

Hello,

Thanks for your inquiry.
Please refer to the following code to set custom color for the text.
Code: Select all
            //headerPdfTextWebLink.Brush = PdfBrushes.DodgerBlue;
            headerPdfTextWebLink.Brush = new PdfSolidBrush(new PdfRGBColor(100,20,130));


Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Thu Feb 03, 2022 8:44 am

That worked, thanks a lot.

Shefketov
 
Posts: 2
Joined: Wed Feb 02, 2022 4:00 pm

Thu Feb 03, 2022 9:49 am

You are welcome. If you encounter any other issues related to our product, please feel free to contact us.

Sincerely,
Brian
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF