PdfColor from Hex

How can I convert hex to PdfColor/PdfBrush?
Thanks

1 Reply

SK Sasi Kumar Sekar Syncfusion Team June 15, 2018 08:59 AM UTC

Hi Caleb, 
 
Thank you for contacting Syncfusion support. 
 
At present we do not have direct support for creating PdfColor from Hexadecimal and we can achieve same in workaround by using Xamarin.Forms.Color. Please find the code snippet for creating PdfColor and PdfBrush. 
Code snippet: 
         
           //Creating Color from Xamarin.Forms 
            Xamarin.Forms.Color c = Xamarin.Forms.Color.FromHex("#FF0000"); 
 
            //Creating PdfColor. 
            PdfColor color = new PdfColor(Syncfusion.Drawing.Color.FromArgb((int)c.A*255, (int)c.R*255, (int)c.G*255, (int)c.B*255)); 
 
            //Creating PdfSolidBrush. 
            PdfSolidBrush brush= new PdfSolidBrush(color); 
 
 
Please let us know if you need further assistance on this. 
Regards, 
Sasi Kumar S. 


Loader.
Up arrow icon