Back to Devexpress

PdfGraphicsAcroFormBorderAppearance Class

officefileapi-devexpress-dot-pdf-5c5f42c7.md

latest3.9 KB
Original Source

PdfGraphicsAcroFormBorderAppearance Class

Contains border appearance settings of an interactive form field.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Drawing.dll

NuGet Package : DevExpress.Pdf.Drawing

Declaration

csharp
public class PdfGraphicsAcroFormBorderAppearance
vb
Public Class PdfGraphicsAcroFormBorderAppearance

The following members return PdfGraphicsAcroFormBorderAppearance objects:

Example

This example uses PDF Graphics API to create a check box field and add it to a new page.

View Example

csharp
using DevExpress.Pdf;
using System.Drawing;
//...
static void Main(string[] args)
{
    using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
    {
        // Create an empty document.
        processor.CreateEmptyDocument("..\\..\\Result.pdf");

        // Create graphics and draw a check box field.
        using (PdfGraphics graphics = processor.CreateGraphicsPageSystem())
        {
            DrawCheckBoxField(graphics);

            // Render a page with graphics.
            processor.RenderNewPage(PdfPaperSize.Letter, graphics);
        }
    }
}

static void DrawCheckBoxField(PdfGraphics graphics)
{
    // Create a check box field specifying its name and location.
    PdfGraphicsAcroFormCheckBoxField checkBox = new PdfGraphicsAcroFormCheckBoxField("check box", new RectangleF(20, 20, 30, 30));

    // Specify check box appearance, checked state, and button style.
    checkBox.Appearance.BackgroundColor = Color.Azure;
    checkBox.Appearance.BorderAppearance = new PdfGraphicsAcroFormBorderAppearance()
    { Color = Color.Red };
    checkBox.IsChecked = true;
    checkBox.ButtonStyle = PdfAcroFormButtonStyle.Star;

    // Add the field to the document.
    graphics.AddFormField(checkBox);
}
vb
Imports DevExpress.Pdf
Imports System.Drawing
'...
Shared Sub Main(ByVal args() As String)
    Using processor As New PdfDocumentProcessor()

        ' Create an empty document.
        processor.CreateEmptyDocument("..\..\Result.pdf")

        ' Create graphics and draw a check box field.
        Using graphics As PdfGraphics = processor.CreateGraphicsPageSystem()
            DrawCheckBoxField(graphics)

            ' Render a page with graphics.
            processor.RenderNewPage(PdfPaperSize.Letter, graphics)
        End Using
    End Using
End Sub

Private Shared Sub DrawCheckBoxField(ByVal graphics As PdfGraphics)

    ' Create a check box field specifying its name and location.
    Dim checkBox As New PdfGraphicsAcroFormCheckBoxField("check box", New RectangleF(20, 20, 30, 30))

    ' Specify check box appearance, checked state, and button style.
    checkBox.Appearance.BackgroundColor = Color.Azure
    checkBox.Appearance.BorderAppearance = New PdfGraphicsAcroFormBorderAppearance() With {.Color = Color.Red}
    checkBox.IsChecked = True
    checkBox.ButtonStyle = PdfAcroFormButtonStyle.Star

    ' Add the field to the document.
    graphics.AddFormField(checkBox)
End Sub

Inheritance

Object PdfGraphicsAcroFormBorderAppearance

See Also

PdfGraphicsAcroFormBorderAppearance Members

DevExpress.Pdf Namespace