Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Am working on a c# in form that creates a pdf file out of the content in the richtextbox..the program it writing to the file but i need to it to space in the first word of each paragraph.
For example
"The light was too much that i couldn't see a thing in the room,the next thing i know am in a hospital bed"

How i want the paragraph in the pdf file be
👇🏻👇🏻
"[Tab space]The light was too much that i couldn't see a thing in the room,the next thing i know am in a hospital bed"

What I have tried:

What code am using to write richtextbox content to the pdf file is

doc.Add(new iTextsharp.text.Paragraph (richTextBox.text))

I need help on how to indent inwards the line of a paragraph or formating a richtextbox content
Posted
Updated 21-Jun-21 3:54am

Simple, do not write to the file direct from the text box. Use a StringBuilder to create the prefix text followed by the data from the textbox.
 
Share this answer
 
Rather than trying to insert spaces at the start of each paragraph, set the first line indent on the Paragraph object:
C#
var para = new iTextsharp.text.Paragraph(richTextBox.text);
para.SetFirstLineIndent(75);
doc.Add(para);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900