Hello,
I have two long paragraph of text (wordwarp is necessary) with different font styles I want to write to a pdf file. I need them to be separated by specific amount of space. I can't find a way to do it in spire.pdf, can you help?
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.Pages.Add(PdfPageSize.A4);
PdfSection sec = doc.Sections.Add();
//draw the first string on Pdf page
string s1 = "Spire.PDF owns the ability of drawing text in PDF document. It supports text formatting, multilingual and text extraction. Here we will introduce how to draw text in PDF with different styles. ";
//set the font
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Helvetica", 18f, FontStyle.Regular));
PdfSolidBrush brush1 = new PdfSolidBrush(Color.DeepSkyBlue);
RectangleF re = new RectangleF(0, 20, page.GetClientSize().Width, page.GetClientSize().Height);
page.Canvas.DrawString(s1, font, brush1, re);
//draw the second string on Pdf page
string s2 = "Spire.PDF enables users to draw rotate text in PDF, draw transform text in PDF, draw alignment text in PDF, draw alignment text in rectangle and other style settings such as font, size, color, pen, etc.";
//set the font
PdfTrueTypeFont font1 = new PdfTrueTypeFont(new Font("TimesRoman", 12f, FontStyle.Italic));
PdfSolidBrush brush2 = new PdfSolidBrush(Color.Red);
RectangleF re1 = new RectangleF(0, 150, page.GetClientSize().Width, page.GetClientSize().Height);
page.Canvas.DrawString(s2, font1, brush2, re1);
doc.SaveToFile("result.pdf", FileFormat.PDF);