Table of Contents

Class ZoneBuilder

Espace de noms
SecureExchangesSDK.Helpers
Assembly
SecureExchangesSDK.NetCore.dll

Helper class for creating signature zones on a PDF document. Initializes once per PDF and caches page dimensions for optimal performance.

public class ZoneBuilder : IDisposable
Héritage
ZoneBuilder
Implements
Membres hérités
Extension Methods

Remarques

Use this class when creating multiple zones on the same PDF to avoid repeatedly opening the file. Implements IDisposable for proper resource cleanup.

Constructors

ZoneBuilder(byte[], bool)

Initializes a new instance of the ZoneBuilder class. Opens the PDF document from a byte array and prepares for zone creation.

public ZoneBuilder(byte[] fileBytes, bool isPki = true)

Paramètres

fileBytes byte[]

The bytes of the PDF file

isPki bool

Whether the signature process uses PKI (true by default)

Exceptions

ArgumentException

Thrown when the byte array is null or empty

ZoneBuilder(string, bool)

Initializes a new instance of the ZoneBuilder class. Opens the PDF document from a file path and prepares for zone creation.

public ZoneBuilder(string filePath, bool isPki = true)

Paramètres

filePath string

The full path to the PDF file

isPki bool

Whether the signature process uses PKI (true by default)

Exceptions

ArgumentException

Thrown when the file path is null or empty

FileNotFoundException

Thrown when the PDF file does not exist

Properties

IsPki

Gets a value indicating whether the signature process uses PKI (Public Key Infrastructure) mode. When true, additional zone types like TextArea and OptionList are available.

public bool IsPki { get; }

Valeur de la propriété

bool

PageCount

Gets the total number of pages in the PDF document.

public int PageCount { get; }

Valeur de la propriété

int

Methods

CreateFieldCheckBoxZone(int, string, float, float, bool, bool, bool)

Creates a checkbox zone on the PDF document.

public SignZoneDetails CreateFieldCheckBoxZone(int page, string fieldName, float x, float y, bool isChecked = false, bool required = false, bool requiredFocus = false)

Paramètres

page int
fieldName string
x float
y float
isChecked bool
required bool
requiredFocus bool

Retour

SignZoneDetails

CreateFieldDateSignZone(int, string, float, float, float, float, float)

Creates a date signature zone (auto-filled with signature date) on the PDF document.

public SignZoneDetails CreateFieldDateSignZone(int page, string fieldName, float x, float y, float width, float height, float fontSize = 12)

Paramètres

page int
fieldName string
x float
y float
width float
height float
fontSize float

Retour

SignZoneDetails

CreateFieldDateZone(int, string, float, float, float, float, float, bool)

Creates a date picker zone on the PDF document.

public SignZoneDetails CreateFieldDateZone(int page, string fieldName, float x, float y, float width, float height, float fontSize = 12, bool required = true)

Paramètres

page int
fieldName string
x float
y float
width float
height float
fontSize float
required bool

Retour

SignZoneDetails

CreateFieldDropdownZone(int, string, float, float, float, float, string[], string, float, bool)

Creates a dropdown zone on the PDF document.

public SignZoneDetails CreateFieldDropdownZone(int page, string fieldName, float x, float y, float width, float height, string[] options, string selectedValue = null, float fontSize = 12, bool required = false)

Paramètres

page int
fieldName string
x float
y float
width float
height float
options string[]
selectedValue string
fontSize float
required bool

Retour

SignZoneDetails

Exceptions

NotSupportedException

Thrown when isPki is false.

ArgumentException

Thrown when options is null or empty.

CreateFieldInitialZone(int, string, float, float, float, float)

Creates an initials zone on the PDF document.

public SignZoneDetails CreateFieldInitialZone(int page, string fieldName, float x, float y, float width, float height)

Paramètres

page int
fieldName string
x float
y float
width float
height float

Retour

SignZoneDetails

CreateFieldNumberZone(int, string, float, float, float, float, int, float, bool)

Creates a number input zone on the PDF document.

public SignZoneDetails CreateFieldNumberZone(int page, string fieldName, float x, float y, float width, float height, int defaultValue, float fontSize = 12, bool required = true)

Paramètres

page int
fieldName string
x float
y float
width float
height float
defaultValue int
fontSize float
required bool

Retour

SignZoneDetails

CreateFieldOptionListZone(int, string, float, float, float, float, string[], string[], bool, bool)

Creates an option list (select) zone on the PDF document.

public SignZoneDetails CreateFieldOptionListZone(int page, string fieldName, float x, float y, float width, float height, string[] options, string[] selectedValues = null, bool multiSelect = false, bool required = false)

Paramètres

page int
fieldName string
x float
y float
width float
height float
options string[]
selectedValues string[]
multiSelect bool
required bool

Retour

SignZoneDetails

Exceptions

NotSupportedException

Thrown when isPki is false.

ArgumentException

Thrown when options is null or empty.

CreateFieldRadioZone(int, string, float, float, string, bool)

Creates a radio button zone on the PDF document.

public SignZoneDetails CreateFieldRadioZone(int page, string fieldName, float x, float y, string groupId, bool isSelected = false)

Paramètres

page int
fieldName string
x float
y float
groupId string
isSelected bool

Retour

SignZoneDetails

CreateFieldSignZone(int, string, float, float, float, float)

Creates a signature zone on the PDF document.

public SignZoneDetails CreateFieldSignZone(int page, string fieldName, float x, float y, float width, float height)

Paramètres

page int
fieldName string
x float
y float
width float
height float

Retour

SignZoneDetails

CreateFieldTextAreaZone(int, string, float, float, float, float, string, float, bool)

Creates a text area (multiline text) zone on the PDF document.

public SignZoneDetails CreateFieldTextAreaZone(int page, string fieldName, float x, float y, float width, float height, string defaultValue = "", float fontSize = 12, bool required = false)

Paramètres

page int
fieldName string
x float
y float
width float
height float
defaultValue string
fontSize float
required bool

Retour

SignZoneDetails

Exceptions

NotSupportedException

Thrown when isPki is false.

CreateFieldTextZone(int, string, float, float, float, float, string, float, bool)

Creates a text input zone on the PDF document.

public SignZoneDetails CreateFieldTextZone(int page, string fieldName, float x, float y, float width, float height, string defaultValue = "", float fontSize = 12, bool required = true)

Paramètres

page int
fieldName string
x float
y float
width float
height float
defaultValue string
fontSize float
required bool

Retour

SignZoneDetails

Dispose()

Releases all resources used by the ZoneBuilder.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Paramètres

disposing bool

~ZoneBuilder()

Finalizer for the ZoneBuilder class.

protected ~ZoneBuilder()

GetPageDimensions(int)

Gets the page dimensions for a specific page, using cached values when available.

public PdfPageDimensions GetPageDimensions(int page)

Paramètres

page int

Page number (1-based)

Retour

PdfPageDimensions

Page dimensions in points (72 DPI)