Property
Data
Stream Data { get; }
Gets the underlying source stream for the PDF.
API Reference
Use the developer guide for workflows and examples, then drop into this reference for canonical signatures, XML-backed member descriptions, and save-time behavior details.
Interface
ZingPDF
public interface IPdf
Represents a loaded or newly created PDF document.
Property
Stream Data { get; }
Gets the underlying source stream for the PDF.
Property
IPdfObjectCollection Objects { get; }
Gets the low-level PDF object collection for advanced scenarios.
Method
Task AuthenticateAsync(string password);
Unlocks the PDF for reading and/or writing. The password can be a user password or an owner password.
Method
Task<IList<IndirectObject>> GetAllPagesAsync();
Gets every page indirect object in page order.
Method
Task<Page> GetPageAsync(int pageNumber);
Gets a page by its 1-based page number.
Method
Task<int> GetPageCountAsync();
Gets the number of pages in the document.
Method
Task<Form?> GetFormAsync();
Gets the document form wrapper if the PDF contains an AcroForm.
Method
Task<PdfMetadata> GetMetadataAsync();
Gets the editable document metadata backed by the trailer Info dictionary.
Method
Task<Page> AppendPageAsync(Action<PageDictionary.PageCreationOptions>? configureOptions = null);
Appends a new page to the end of the document.
Method
Task<Page> InsertPageAsync(int pageNumber, Action<PageDictionary.PageCreationOptions>? configureOptions = null);
Inserts a new page before the specified 1-based page number.
Method
Task DeletePageAsync(int pageNumber);
Deletes a page by its 1-based page number.
Method
Task SetRotationAsync(Rotation rotation);
Sets the rotation for every page in the document.
Method
Task<IEnumerable<ExtractedText>> ExtractTextAsync();
Extracts text from the document.
Method
Task AddWatermarkAsync(string text);
Adds a simple text watermark to each page.
Method
void Compress(int dpi, int quality);
Compresses eligible streams in the document.
Method
Task DecompressAsync();
Removes compression filters from all objects in the PDF.
Method
Task EncryptAsync(string userPassword, string? ownerPassword = null);
Saves the PDF using standard password protection.
Method
Task DecryptAsync(string password);
Authenticates with the supplied password and saves the PDF without encryption.
Method
Task AppendPdfAsync(Stream stream);
Appends the pages from another PDF stream to the current document.
Method
Task SaveAsync(Stream outputStream);
Saves the document by writing an incremental update.
Class
ZingPDF
public sealed class PdfMetadata
Represents editable document metadata backed by the trailer Info dictionary.
Property
public string? Title
Gets or sets the document title.
Property
public string? Author
Gets or sets the document author.
Property
public string? Subject
Gets or sets the document subject.
Property
public string? Keywords
Gets or sets document keywords.
Property
public string? Creator
Gets or sets the application or person that originally created the document.
Property
public string? Producer { get; private set; }
Gets the producer value that will be written by ZingPDF on save.
Property
public DateTimeOffset? CreationDate
Gets or sets the original document creation date.
Property
public DateTimeOffset? ModifiedDate { get; private set; }
Gets the modification date that will be written on save.
Class
ZingPDF.Elements
public class Page
Represents a single page in a PDF document.
Property
public IndirectObject IndirectObject { get; }
Gets the underlying indirect object for the page.
Property
public PageDictionary Dictionary { get; }
Gets the page dictionary for the page.
Method
public Task AddTextAsync(TextObject text)
Adds a text object to the page contents.
Method
public Task AddImageAsync(Image image)
Adds an image to the page contents.
Method
public Task RotateAsync(Rotation rotation)
Applies an additional rotation to the page.
Class
ZingPDF.Elements.Forms
public class Form
Represents an AcroForm attached to a PDF document.
Method
public Task<IEnumerable<IFormField>> GetFieldsAsync()
Enumerates the terminal form fields in the document.
Interface
ZingPDF.Elements.Forms
public interface IFormField
Common metadata exposed for every discovered AcroForm field.
Property
string? Description { get; }
Gets the user-facing description or tooltip for the field, when present.
Property
string Name { get; }
Gets the fully qualified field name.
Property
FieldProperties Properties { get; }
Gets the decoded field flags.
Method
Task<Size> GetFieldDimensionsAsync();
Gets the field rectangle size.
Class
ZingPDF.Elements.Forms.FieldTypes.Text
public class TextFormField : FormField<PdfString>
Represents a text form field.
Method
public Task<string?> GetValueAsync()
Gets the current field value as decoded text.
Method
public Task SetValueAsync(string? value)
Sets the field value and regenerates the field appearance.
Method
public Task<ContentStream?> GetAPAsync()
Gets the field appearance stream, primarily for diagnostics and testing.
Method
public Task ClearAsync()
Clears the field value and wipes its appearance stream.
Class
ZingPDF.Elements.Forms.FieldTypes.Choice
public abstract class ChoiceFormField( IndirectObject fieldIndirectObject, string name, string? description, FieldProperties properties, Form parent, IPdf pdf ) : FormField<IPdfObject>(fieldIndirectObject, name, description, properties, parent, pdf)
Base class for choice fields such as combo boxes and list boxes.
Method
public Task<IReadOnlyList<ChoiceItem>> GetOptionsAsync()
Gets the available options for the field, including their current selected state.
Class
ZingPDF.Elements.Forms.FieldTypes.Choice
public class ChoiceItem
Represents a selectable option in a choice field.
Property
public PdfString Text { get; set; }
Gets or sets the display text for the option.
Property
public PdfString Value { get; set; }
Gets or sets the stored option value written to the field when this item is selected.
Property
public bool Selected { get; }
Gets whether the option is currently selected.
Method
public Task SelectAsync();
Selects this option.
Method
public Task DeselectAsync();
Deselects this option.
Class
ZingPDF.Elements.Forms.FieldTypes.Button
public abstract class ButtonOptionsFormField : FormField<Name>
Base class for checkbox and radio-button fields.
Method
public Task<IReadOnlyList<SelectableOption>> GetOptionsAsync()
Gets the selectable options for the field.
Class
ZingPDF.Elements.Forms.FieldTypes.Button
public class CheckboxFormField : ButtonOptionsFormField
Represents a checkbox field whose options can be toggled on or off.
Class
ZingPDF.Elements.Forms.FieldTypes.Button
public class RadioButtonFormField : ButtonOptionsFormField
Represents a radio-button field where selecting one option usually clears the others in the same group.
Class
ZingPDF.Elements.Forms.FieldTypes.Button
public class PushButtonFormField : FormField<IPdfObject>
Represents a push-button field in an AcroForm.
Class
ZingPDF.Elements.Forms.FieldTypes.Button
public class SelectableOption
Represents a selectable checkbox or radio-button option.
Property
public string Text { get; set; }
Gets or sets the display text for the option.
Property
public string Value { get; set; }
Gets or sets the export value written to the field when this option is selected.
Property
public bool Selected { get; }
Gets whether the option is currently selected.
Method
public Task SelectAsync();
Selects this option.
Method
public Task DeselectAsync();
Deselects this option.
Class
ZingPDF.Elements.Forms.FieldTypes.Signature
public class SignatureFormField : FormField<IPdfObject>
Represents a signature field.