Table of Contents

Class ZoneBuilder

Namespace
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
Inheritance
ZoneBuilder
Implements
Inherited Members
Extension Methods

Remarks

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)

Parameters

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)

Parameters

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; }

Property Value

bool

PageCount

Gets the total number of pages in the PDF document.

public int PageCount { get; }

Property Value

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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

Returns

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)

Parameters

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)

Parameters

page int

Page number (1-based)

Returns

PdfPageDimensions

Page dimensions in points (72 DPI)