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.

Tue Jan 04, 2022 1:13 pm

Hi ,

Long text is not wrapping to next line automatically in pdf . Please help me how to do this dynamically and please provide me a sample code if possible.

Thanks in advance.

my sample drawstring code:
page.Canvas.DrawString("Congratulations on your entry into the plan Please use the attached document to log into the website and select your investment elections.If you have questions about plan rules and features, accessing your account, or navigating the user site, please contact our support care", font, brush, x, y += 15);

JayanthiJaya
 
Posts: 22
Joined: Thu Jan 21, 2021 6:06 am

Wed Jan 05, 2022 8:32 am

Hello,

Thanks for your inquiry!
Please refer to the following sample code to achieve your demand.
Code: Select all
 PdfDocument doc = new PdfDocument();
 PdfPageBase page = doc.Pages.Add(PdfPageSize.A4, new PdfMargins(20));
 PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 11);
 PdfBrush brush = PdfBrushes.Black;
 float x = 0;
 float y = 0;
 float width = page.ActualSize.Width - 30;
 float height = 200;
 RectangleF rctg = new RectangleF(x, y, width, height);
 page.Canvas.DrawString("Congratulations on your entry into the plan Please use the attached document to log into the website and select your investment elections.If you have questions about plan rules and features, accessing your account, or navigating the user site, please contact our support care", font, brush, rctg);
 doc.SaveToFile("output.pdf");

If there is any other question, just feel free to contact us!

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 203
Joined: Mon Dec 27, 2021 2:23 am

Tue Jan 18, 2022 7:34 am

Hello,

Greetings from E-iceblue. Could you please let us know how is the issue going? Thanks in advance for your feedback and time.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 203
Joined: Mon Dec 27, 2021 2:23 am

Tue Nov 29, 2022 9:53 pm

continuing on this thread, let's say I have a RectangleF object and text in it.
I wanted to fit the text in the rectangle and for that I need to decrease the font size.
Is there a way to do that? auto-resize font or a calculation process that tells me when I have the right text font size that fits in the RectangleF?
Thanks!

ramziiceblue
 
Posts: 3
Joined: Fri Sep 06, 2019 2:38 pm

Wed Nov 30, 2022 9:37 am

Hello,

Thanks for your inquiry.
Sorry for that our Spire.Pdf doesn’t achieve your requirement.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 967
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF