Newline in FormattedTextArea

Newline in FormattedTextArea

Forum member · Jan 27, 2011
Our customer has a wish to create "soft" newlines in a formattedtextarea. Consider the following two samples of HTML that *should* yield different PDF output, but yields the same PDF output: 1. <p>Some text<br />with a soft linebreak</p> 2. <p>Some text</p><p>with a hard linebreak</p> These two HTML samples yield the exact same PDF output using FormattedTextArea. How is it possible to just add a linebreak in example 1, instead of a new paragraph?

Re: Newline in FormattedTextArea

Support · Jan 27, 2011
Hello, Are you trying to add the indent to the paragraph? If so you will have to set indent to the paragraph using the Indent property of the Paragraph class. By default the indent will be set to zero and this is the reason you are seeing the same behavior for both of your examples. Below is the code to set indent for the paragraph. FormattedTextAreaStyle style = new FormattedTextAreaStyle(FontFamily.Helvetica, 14, true); string text="<p>Some text <br />with a soft linebreak </p>" ; FormattedTextArea area = new FormattedTextArea(text, 10, 150, 200, 100, style); string formattedText = "<p>Some text to check the paragraph</p><p>with a hard linebreak with HTML br tag and this should be added with some indent</p> "; FormattedTextArea formattedTextArea = new FormattedTextArea(formattedText, 10, 10, 200, 100, FontFamily.Helvetica, 14, true); formattedTextArea.Style.Paragraph.Indent = 20; Document document = new Document(); Page page = new Page(); page.Elements.Add(formattedTextArea); page.Elements.Add(area); document.Pages.Add(page); document.Draw(@"C:\Temp\Test.pdf"); Thanks, ceTe Software Team.

Re: Newline in FormattedTextArea

Forum member · Jan 27, 2011
I do not wish to indent the text. I want the first example to look like this in the PDF: [begin] Some text with a soft linebreak [end] And the second example to look like this: [begin] Some text with a hard linebreak [end] (The PDF rendering code should be equal for both cases)

Re: Newline in FormattedTextArea

Support · Jan 28, 2011
Hello, You can use the SpacingAfter property of the paragraph style class to set the desired spacing btween the paragraphs using our DynamicPDF Generator API. Below is the code for it. FormattedTextAreaStyle style = new FormattedTextAreaStyle(FontFamily.Helvetica, 14, true); string text = "<p>Some text <br />with a soft linebreak </p>"; FormattedTextArea area = new FormattedTextArea(text, 10, 10, 200, 100, style); string formattedText = "<p>Some text </p><p>with a hard linebreak </p> "; FormattedTextArea formattedTextArea = new FormattedTextArea(formattedText, 10, 150, 200, 100, FontFamily.Helvetica, 14, true); formattedTextArea.Style.Paragraph.SpacingAfter = 10; Document document = new Document(); Page page = new Page(); page.Elements.Add(area); page.Elements.Add(formattedTextArea); document.Pages.Add(page); document.Draw(@"C:\Temp\Test.pdf"); Thanks, ceTe Software Support Team.

Re: Newline in FormattedTextArea

Forum member · Jan 28, 2011
Tried using the SpacingAfter property, but that affects both the soft linebreaks and the hard linebreaks. I get hard linebreaks for both <p> and <br/> with indent = 0, spacingafter = 12, spacingbefore = 0

Re: Newline in FormattedTextArea

Forum member · Jan 28, 2011
To clarify, I want this in the SAME FormattedTextArea object. Not different FormattedTextArea objects. As stated earlier "same code" for both cases. /Peter

Re: Newline in FormattedTextArea

Support · Jan 28, 2011
Hello Peter, Can you please let us know what build of our DynamicPDF product you are using? Also please send over the sample code which you are using and output PDF document to our support team at: [^a|mailto:support@cete.com|opennewiwndow|support@cete.com^] so that they can look into it further. Thanks, ceTe Software Support Team.

Re: Newline in FormattedTextArea

Forum member · Jan 28, 2011
Resolved with new version of the ceTe assembly!

Re: Newline in FormattedTextArea

Forum member · Apr 25, 2011
One small addition query how can we add a line (not line break just a simple line to the formattedtext

Re: Newline in FormattedTextArea

Support · Apr 26, 2011
Hello, Can you please send over more details about your requirements and also tell us what you are trying to achieve using our DynamicPDF product to our support team at: [^a|mailto:support@cete.com|opennewiwndow|support@cete.com^] so that they can look into it further? Thanks, ceTe Software Support Team.

Re: Newline in FormattedTextArea

Support · Jun 21, 2011
Hello, If anyone is having the same issue with v5, please send an email to [^a|mailto:support@cete.com|opennewiwndow|support@cete.com^] referring to the URL of this post so we can send you the latest build that fixes the issue. Thanks, ceTe Software Support Team.