We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

String Alignment Centre

Thread ID:

Created:

Updated:

Platform:

Replies:

129639 Mar 27,2017 07:37 AM Mar 28,2017 08:04 AM UWP 1
loading
Tags: Pdf
Corey Powell
Asked On March 27, 2017 07:37 AM

Hi the code below is working fine, however, I would like a way to align the string centrally in the Rectangle, rather than using the "header.Left + 10" command

Many Thanks in advance,

 String drawString = "1.Retail Manager, Assistant Manager, Team Leader, Colleagues 121's and Talent Pipeline";
                PdfBrush solidBrush = new PdfSolidBrush(new PdfColor(51, 51, 255));
                     RectangleF header = new RectangleF(20, 30, 520, 20);
                          graphics.DrawRectangle(solidBrush, header);
                               PdfFont subHeadingFont = new PdfStandardFont(PdfFontFamily.TimesRoman, 14);
                                    PdfTextElement element = new PdfTextElement(drawString,subHeadingFont);
                                         element.Brush = PdfBrushes.White;
                                                   element.Draw(page2, new PointF(header.Left + 10, header.Top + 2)); 

Bhuvaneswari Nagarajan [Syncfusion]
Replied On March 28, 2017 08:04 AM

Hi Corey, 
 
Thank you for using Syncfusion products, 
 
We have created the sample to achieved your requirement by using PdfStringFormat. We have attached the sample for your reference. Please find the sample from below link, 
 
 
Please let me know if you need further assistance. 
 
Regards, 
Bhuvaneswari N. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;