|
Rank: Member Groups: Member
Joined: 7/19/2011 Posts: 14
|
I am copying text from a rich text box using an AcmText object, and then rendering it. It appears that any line break (cf + lf) is being ignored when the PDF file is created. Also, I have noticed that adding an AcmLineBreak seems to only insert a space.
Am I using the wrong items to add the text to the PDF? Here is a sample:
text = New AcmText(rtfHolder.SelectedText) text.Style.FontStyle = FontStyle.Italic text.Style.FontSize = 10 render.Render(text) render.Render(New AcmLineBreak)
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
By default, AcmText ignores line breaks so that it's possible for you to generate a single paragraph from multiple lines of text literal. We will have an option for you enable/disable this feature.
AcmLineBreak works only if you use it in the middle of your render tree. For example:
render.Render(text1, new AcmLineBreak(), text2)
Will insert a line break in between text1 and text2.
Alternatively, you can also use AcmParagraph. An AcmParagraph will automatically start a new line.
Hope this helps. Please feel free to let us know if you have any more question.
Thanks!
|
|
Rank: Member Groups: Member
Joined: 7/19/2011 Posts: 14
|
Using the paragraphs lets me put in the line breaks. Thanks.
But how do I preserve the line breaks from the copied text?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
For that you will have to wait for our next build, which should be out today or tomorrow. We have an option on AcmText that supposes to let you to specify whether ignore line break or not but it's not working correctly in the current build. That will be fixed in the next build.
Thanks!
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, We have posted a 2011.2.56 that addressed this issue. You would need to set AcmText's AutoTrim to false to preserve line breaks. For example:
Code: C#
//Create an AcmText object with multiple lines of text
AcmText text = new AcmText(@"Hello
World");
//Set AutoTrim to false so that AcmText won't remove the line
//breaks. The default value is true
text.AutoTrim = false;
Hope this helps. Please feel free to let us know if you have any more questions. Thanks!
|
|