C1.Silverlight.Pdf.5 Assembly > C1.Silverlight.Pdf Namespace > C1PdfDocument Class > DrawString Method : DrawString(String,Font,Color,Rect,Int32,StringFormat) Method |
The sf contains properties that specify formatting options. Use the StringFormat.Alignment property to specify horizontal alignment and the StringFormat.LineAlignment property to specify vertical alignment.
Use the StringFormat.FormatFlags property to specify clipping and wrapping.
To render text in the vertical direction, use the StringFormatFlags.DirectionVertical. By itself, this flag will cause text to render from the bottom to the top of the rectangle. Combined with the StringFormatFlags.DirectionRightToLeft flags, it will cause text to render from the top to the bottom of the rectangle.
The DrawString method returns the index of the first character that was not printed because it did not fit the output rectangle. You can use this value to make text flow from page to page, or from one frame to another within a page.
// render string spanning multiple pages for (int start = 0; start < int.MaxValue;) { // render as much as will fit into the rectangle start = _c1pdf.DrawString(text, font, Brushes.Black, rcPage, start); // move on to the next page _c1pdf.NewPage(); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2