Class PdfMark
Represents a semantic mark attached to a page object, such as accessibility or structure metadata.
public sealed class PdfMark
- Inheritance
-
PdfMark
- Inherited Members
Properties
Name
Gets the name associated with the current PDF page object mark.
public string Name { get; }
Property Value
Remarks
This property retrieves the name of the mark associated with the PDF page object. If the name cannot be determined, an empty string is returned.
ParameterCount
Gets the number of parameters associated with the current PDF page object mark.
public int ParameterCount { get; }
Property Value
Remarks
This property retrieves the number of parameters defined for the mark associated with the PDF page object. It can be used to iterate through or inspect the parameters of the mark.
Methods
GetBlobValue(string)
Retrieves the binary data (blob) associated with the specified key.
public byte[]? GetBlobValue(string key)
Parameters
Returns
- byte[]
A byte array containing the blob value associated with the specified key, or null if the key does not exist or the blob value is empty.
Remarks
This method attempts to retrieve binary data associated with the given key. If the key is not found or the blob value is empty, the method returns null.
GetIntValue(string)
Retrieves the integer value associated with the specified key from the underlying object.
public int? GetIntValue(string key)
Parameters
key
stringThe key identifying the parameter whose integer value is to be retrieved. Cannot be null or empty.
Returns
- int?
The integer value associated with the specified key, or null if the key does not exist or the value cannot be retrieved.
GetParamKeys()
Retrieves the keys of all parameters associated with the current page object mark.
public IEnumerable<string> GetParamKeys()
Returns
- IEnumerable<string>
An IEnumerable<T> of strings containing the parameter keys. The collection will be empty if no parameters are associated with the page object mark.
Remarks
This method enumerates the parameter keys for the page object mark represented by the current instance. The keys are returned as UTF-8 encoded strings. If a key cannot be retrieved, an empty string is returned for that key.
GetParamType(string)
Retrieves the parameter type associated with the specified key in the PDF mark.
public PdfMarkParamType GetParamType(string key)
Parameters
key
stringThe key identifying the parameter whose type is to be retrieved. Cannot be null or empty.
Returns
- PdfMarkParamType
The PdfMarkParamType representing the type of the parameter associated with the specified key.
Remarks
This method queries the underlying PDF object to determine the type of the parameter associated with the given key. Ensure that the key exists in the PDF mark to avoid unexpected results.
GetStringValue(string)
Retrieves the string value associated with the specified key from the PDF page object mark.
public string? GetStringValue(string key)
Parameters
key
stringThe key identifying the parameter whose string value is to be retrieved. Cannot be null or empty.
Returns
- string
The string value associated with the specified key, or null if the key does not exist or the value cannot be retrieved.
RemoveParam(PdfPageObject, string)
Removes a parameter with the specified key from the mark associated with the given PDF page object.
public void RemoveParam(PdfPageObject obj, string key)
Parameters
obj
PdfPageObjectThe PDF page object from which the parameter will be removed. Cannot be null.
key
stringThe key of the parameter to remove. Cannot be null or empty.
Exceptions
- dotPDFiumException
Thrown if the parameter with the specified key could not be removed from the mark.
SetBlobParam(PdfDocument, PdfPageObject, string, byte[])
Sets a blob parameter on a specified mark within a PDF page object.
public void SetBlobParam(PdfDocument doc, PdfPageObject obj, string key, byte[] data)
Parameters
doc
PdfDocumentThe PdfDocument containing the page object.
obj
PdfPageObjectThe PdfPageObject to which the mark belongs.
key
stringThe key identifying the blob parameter to set.
data
byte[]The binary data to associate with the specified key. Must not be null or empty.
Remarks
This method associates binary data with a specific key on a mark within a PDF page object. The operation will fail if the underlying PDF library cannot set the parameter.
Exceptions
- ArgumentException
Thrown if
data
is null or empty.- dotPDFiumException
Thrown if the operation fails to set the blob parameter.
SetIntParam(PdfDocument, PdfPageObject, string, int)
Sets an integer parameter on a mark associated with a PDF page object.
public void SetIntParam(PdfDocument doc, PdfPageObject obj, string key, int value)
Parameters
doc
PdfDocumentThe PdfDocument containing the page object.
obj
PdfPageObjectThe PdfPageObject to which the mark is associated.
key
stringThe key identifying the parameter to set. Cannot be null or empty.
value
intThe integer value to assign to the specified parameter.
Remarks
This method modifies the metadata of a mark associated with a PDF page object by setting an
integer parameter. Ensure that the key
is valid and that the doc
and
obj
are properly initialized before calling this method.
Exceptions
- dotPDFiumException
Thrown if the operation fails to set the integer parameter for the specified key.
SetStringParam(PdfDocument, PdfPageObject, string, string)
Sets a string parameter on a mark associated with a PDF page object.
public void SetStringParam(PdfDocument doc, PdfPageObject obj, string key, string value)
Parameters
doc
PdfDocumentThe PdfDocument containing the page object.
obj
PdfPageObjectThe PdfPageObject to which the mark is associated.
key
stringThe key identifying the parameter to set. Cannot be null or empty.
value
stringThe string value to assign to the parameter. Cannot be null.
Exceptions
- dotPDFiumException
Thrown if the operation fails to set the string parameter.