This is a migrated thread and some comments may be shown as answers.

Multiline text in block

1 Answer 688 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Niraja
Top achievements
Rank 1
Niraja asked on 09 Dec 2019, 04:00 AM

Hi,

I'm currently using FixedContentEditor to create my pdf. I'm using blocks to write the long text like "terms and conditions" at the end of the pdf but it doesnot wrap the text. Is there a way I can insert long text ?

 

FixedContentEditor contentEditor4 = new FixedContentEditor(document.Pages[0], simplePosition4);
Block block4 = new Block();
block4.InsertText("This summary details the voting directions (if any) for business items on the appointment documents in your favour. If you vote these proxy votes you must vote in accordance with these directions. By completing the attached voting paper, when directed to vote in a particular manner, you are deemed to have voted in accordance with those directions.");
contentEditor4.DrawBlock(block4);

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 10 Dec 2019, 10:54 AM

Hello Niraja,

In this case, you need to measure the text using the page size and then pass the size when drawing the text. Here is an example that shows this (some padding is added as well):

RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();

FixedContentEditor editor = new FixedContentEditor(page);

editor.Position.Translate(50, 50);

var block4 = new Block();
block4.InsertText(longText);
var textSize = block4.Measure(new Size(page.Size.Width - 100, page.Size.Height - 100));
editor.DrawBlock(block4, textSize);

editor.Position.Translate(50, textSize.Height + 50);

editor.DrawText("More Text");

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PdfProcessing
Asked by
Niraja
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or