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
fileBytesbyte[]The bytes of the PDF file
isPkiboolWhether 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
filePathstringThe full path to the PDF file
isPkiboolWhether 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é
PageCount
Gets the total number of pages in the PDF document.
public int PageCount { get; }
Valeur de la propriété
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
Retour
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
Retour
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
Retour
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
pageintfieldNamestringxfloatyfloatwidthfloatheightfloatoptionsstring[]selectedValuestringfontSizefloatrequiredbool
Retour
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
Retour
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
pageintfieldNamestringxfloatyfloatwidthfloatheightfloatdefaultValueintfontSizefloatrequiredbool
Retour
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
pageintfieldNamestringxfloatyfloatwidthfloatheightfloatoptionsstring[]selectedValuesstring[]multiSelectboolrequiredbool
Retour
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
Retour
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
Retour
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
pageintfieldNamestringxfloatyfloatwidthfloatheightfloatdefaultValuestringfontSizefloatrequiredbool
Retour
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
pageintfieldNamestringxfloatyfloatwidthfloatheightfloatdefaultValuestringfontSizefloatrequiredbool
Retour
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
disposingbool
~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
pageintPage number (1-based)
Retour
- PdfPageDimensions
Page dimensions in points (72 DPI)