Xamarin.Android

  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class PdfWordWrapType

    Show / Hide Table of Contents

    Class PdfWordWrapType

    Specifies the types of text wrapping.

    Inheritance
    System.Object
    PdfWordWrapType
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Portable.dll
    Syntax
    public sealed class PdfWordWrapType : Enum
    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

    Character

    Text is wrapped by characters. In this case the word at the end of the text line can be split.

    Declaration
    public const PdfWordWrapType Character
    Field Value
    Type Description
    PdfWordWrapType

    None

    Text wrapping between lines when formatting within a rectangle is disabled.

    Declaration
    public const PdfWordWrapType None
    Field Value
    Type Description
    PdfWordWrapType

    value__

    Declaration
    public int value__
    Field Value
    Type Description
    System.Int32

    Word

    Text is wrapped by words. If there is a word that is longer than bounds' width, this word is wrapped by characters.

    Declaration
    public const PdfWordWrapType Word
    Field Value
    Type Description
    PdfWordWrapType

    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.

    Declaration
    public const PdfWordWrapType WordOnly
    Field Value
    Type Description
    PdfWordWrapType
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved