menu

Document Processing

PdfDashStyle Class - C# PDF Library API Reference | Syncfusion

    Show / Hide Table of Contents

    PdfDashStyle Class

    Possible dash styles of the pen.

    Inheritance
    System.Object
    PdfDashStyle
    Namespace: Syncfusion.Pdf.Graphics
    Assembly: Syncfusion.Pdf.Base.dll
    Syntax
    public sealed class PdfDashStyle : Enum
    Examples
    //Create a new PDF document.
    PdfDocument doc = new PdfDocument();
    //Add a page to the document.
    PdfPage page = doc.Pages.Add();
    //Create PDF graphics for the page
    PdfGraphics graphics = page.Graphics;
    //Create new PDF pen instance.
    PdfPen pen = new PdfPen(Color.Red);
    //Set custom dash style.
    pen.DashStyle = PdfDashStyle.Custom;
    // Create a custom dash pattern.
    pen.DashPattern = new float[] { 4.0f, 2.0f, 1.0f, 3.0f };
    //Draw rectangle.
    graphics.DrawRectangle(pen, new RectangleF(10, 10, 200, 100));
    //Save the document.
    doc.Save("Output.pdf");
    //Close the document.
    doc.Close(true);
    'Create a new PDF document.
    Dim doc As New PdfDocument()
    'Add a page to the document.
    Dim page As PdfPage = doc.Pages.Add()
    'Create PDF graphics for the page
    Dim graphics As PdfGraphics = page.Graphics
    'Create new PDF pen instance.
    Dim pen As New PdfPen(Color.Red)
     'Set custom dash style.
     pen.DashStyle = PdfDashStyle.Custom
     'Create a custom dash pattern.
     pen.DashPattern = New Single() { 4.0F, 2.0F, 1.0F, 3.0F}
    'Draw rectangle.
    graphics.DrawRectangle(pen, New RectangleF(10, 10, 200, 100))
    'Save the document.
    doc.Save("Output.pdf")
    'Close the document.
    doc.Close(True)

    Fields

    Custom

    User defined dash style.

    Declaration
    public const PdfDashStyle Custom
    Field Value
    Type
    PdfDashStyle

    Dash

    Dashed line.

    Declaration
    public const PdfDashStyle Dash
    Field Value
    Type
    PdfDashStyle

    DashDot

    Dash-dot line.

    Declaration
    public const PdfDashStyle DashDot
    Field Value
    Type
    PdfDashStyle

    DashDotDot

    Dash-dot-dot line.

    Declaration
    public const PdfDashStyle DashDotDot
    Field Value
    Type
    PdfDashStyle

    Dot

    Dotted line.

    Declaration
    public const PdfDashStyle Dot
    Field Value
    Type
    PdfDashStyle

    Solid

    Solid line.

    Declaration
    public const PdfDashStyle Solid
    Field Value
    Type
    PdfDashStyle
    Back to top Generated by DocFX
    OSZAR »
    Copyright © 2001 - 2025 Syncfusion Inc. All Rights Reserved
    OSZAR »