Enum PdfWordWrapType
Specifies the types of text wrapping.
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Base.dll
Syntax
public enum PdfWordWrapType
Examples
//Create a new PDF document.
PdfDocument document = new PdfDocument();
//Add a page to the document.
PdfPage page = document.Pages.Add();
//Create PDF graphics for the page.
PdfGraphics graphics = page.Graphics;
//Create a new PDF font instance.
PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12);
//Create a new PDF string format instance.
PdfStringFormat format = new PdfStringFormat();
//Set the text alignment.
format.Alignment = PdfTextAlignment.Center;
//Set the line alignment.
format.LineAlignment = PdfVerticalAlignment.Middle;
//Set character spacing.
format.CharacterSpacing = 1;
//Set clip path.
format.ClipPath = true;
//Set line limit.
format.LineLimit = true;
//Set line spacing.
format.LineSpacing = 1.1f;
//Set measure trailing spaces.
format.MeasureTrailingSpaces = true;
//Set no clip
format.NoClip = true;
//Set paragraph indent.
format.ParagraphIndent = 2.1f;
//Set right to left.
format.RightToLeft = false;
//Set word spacing.
format.WordSpacing = 1.5f;
//Set word wrap type.
format.WordWrap = PdfWordWrapType.Word;
//Set sub/super script type.
format.SubSuperScript = PdfSubSuperScript.SubScript;
//Draw string to PDF page.
graphics.DrawString("Hello World!", font, PdfBrushes.Black, new RectangleF(0, 0, 200, 100), format);
//Save the document.
document.Save("Output.pdf");
//Close the document.
document.Close(true);
'Create a new PDF document.
Dim document As New PdfDocument()
'Add a page to the document.
Dim page As PdfPage = document.Pages.Add()
'Create PDF graphics for the page.
Dim graphics As PdfGraphics = page.Graphics
'Create a new PDF font instance.
Dim font As PdfFont = New PdfStandardFont(PdfFontFamily.Helvetica, 12)
'Create a new PDF string format instance.
Dim format As PdfStringFormat = New PdfStringFormat()
'Set the text alignment.
format.Alignment = PdfTextAlignment.Center
'Set the line alignment.
format.LineAlignment = PdfVerticalAlignment.Middle;
'Set character spacing.
format.CharacterSpacing = 1
'Set clip path.
format.ClipPath = True
'Set line limit.
format.LineLimit = True
'Set line spacing.
format.LineSpacing = 1.1F
'Set measure trailing spaces.
format.MeasureTrailingSpaces = True
'Set no clip
format.NoClip = True
'Set paragraph indent.
format.ParagraphIndent = 2.1F
'Set right to left.
format.RightToLeft = False
'Set word spacing.
format.WordSpacing = 1.5F
'Set word wrap type.
format.WordWrap = PdfWordWrapType.Word
'Set sub/super script type.
format.SubSuperScript = PdfSubSuperScript.SubScript
'Draw string to PDF page.
graphics.DrawString("Hello World!", font, PdfBrushes.Black, New RectangleF(0, 0, 200, 100), format);
'Save the document.
document.Save("Output.pdf")
'Close the document.
document.Close(True)
Fields
Name | Description |
---|---|
Character | Text is wrapped by characters. In this case the word at the end of the text line can be split. |
DiscretionaryHyphen | Text is wrapped by soft hyphen. In this case the word has reached its maximum length, it looks for a soft hyphen within the word and wraps the word accordingly using the soft hyphen. |
None | Text wrapping between lines when formatting within a rectangle is disabled. |
Word | Text is wrapped by words. If there is a word that is longer than bounds' width, this word is wrapped by characters. |
WordOnly | Text is wrapped by words. If there is a word that is longer than bounds' width, it won't be wrapped at all and the process will be finished. |