Search Results for

    Show / Hide Table of Contents

    Class QPdfClient<T>

    Inheritance
    System.Object
    QPdfClient<T>
    Implements
    System.IDisposable
    Namespace: IronSoftware.Pdfium
    Assembly: IronPdf.dll
    Syntax
    public abstract class QPdfClient<T> : Object, IDisposable, IQPdfClient where T : QPdfDeploymentBase
    Type Parameters
    Name Description
    T

    Constructors

    QPdfClient(Boolean)

    Declaration
    protected QPdfClient(bool deployQpdf = true)
    Parameters
    Type Name Description
    System.Boolean deployQpdf

    Methods

    CompleteSavingAsPdfA4(IDocumentId, String, String)

    Applies final PDF/A-4 specific flags and saves the provided PDF content using QPdf.

    Declaration
    public void CompleteSavingAsPdfA4(IDocumentId documentId, string outputPath, string password = "")
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Pdf.IDocumentId documentId

    The id of the input document.

    System.String outputPath

    The file path where the PDF should be saved.

    System.String password

    An optional password to encrypt the PDF. Pass null or an empty string for no password.

    Remarks

    Note: IronSoftware.Pdfium.IPdfClient.ConvertToPdfA(IronSoftware.Abstractions.Pdf.IDocumentId,System.Byte[],IronPdf.InternalPdfAVersion) should be called before invoking this method to perform the actual conversion.

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown if documentId is null.

    System.IO.IOException

    Thrown if there is an error retrieving the PDF bytes from the native PDF library.

    System.Exception

    Thrown if the QPdf handle creation, reading, initialization, or writing fails.

    CompleteSavingAsPdfUA2(IDocumentId, String, String)

    Declaration
    public void CompleteSavingAsPdfUA2(IDocumentId documentId, string outputPath, string password = "")
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Pdf.IDocumentId documentId
    System.String outputPath
    System.String password

    CompressAndSaveAs(IDocumentId, String, Nullable<Int32>, String)

    Save PDF document with compression applied

    Declaration
    public void CompressAndSaveAs(IDocumentId id, string filename, Nullable<int> jpeg, string password)
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Pdf.IDocumentId id

    id of the document

    System.String filename

    path where the compressed file will be saved

    System.Nullable<System.Int32> jpeg

    optional JPEG quality (1-100). If null, image optimization will not be applied

    System.String password

    password of the pdf content

    CompressAndSaveAs(Byte[], String, Nullable<Int32>, String)

    Save PDF document with compression applied

    Declaration
    public void CompressAndSaveAs(byte[] pdfBytes, string filename, Nullable<int> jpeg, string password)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes

    PDF bytes to compress

    System.String filename

    path where the compressed file will be saved

    System.Nullable<System.Int32> jpeg

    optional JPEG quality (1-100). If null, image optimization will not be applied

    System.String password

    password of the pdf content

    CompressInMemory(IDocumentId, String)

    Compresses the PDF document specified by its ID entirely in memory.

    This method retrieves the document bytes from the native and performs structural compression (Object Streams, Flate) without writing to disk.

    Declaration
    public byte[] CompressInMemory(IDocumentId id, string password)
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Pdf.IDocumentId id

    The ID of the document to compress.

    System.String password

    The password if the document is encrypted.

    Returns
    Type Description
    System.Byte[]

    A byte array containing the compressed PDF data.

    Exceptions
    Type Condition
    System.Exception

    Thrown if document bytes cannot be retrieved from the native library.

    CompressInMemory(Byte[], String)

    Compresses raw PDF bytes entirely in memory using structural optimization.

    Declaration
    public byte[] CompressInMemory(byte[] pdfBytes, string password)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes

    The raw byte array of the PDF to compress.

    System.String password

    The password if the document is encrypted.

    Returns
    Type Description
    System.Byte[]

    A byte array containing the compressed PDF data.

    Exceptions
    Type Condition
    System.ArgumentException

    Thrown if pdfBytes is null or empty.

    System.Exception

    Thrown if the native QPdf initialization or writing fails.

    Dispose()

    Declaration
    public virtual void Dispose()

    IsLinearized(String, String)

    Check if a file is linearized or not

    Declaration
    public bool IsLinearized(string path, string password)
    Parameters
    Type Name Description
    System.String path

    file path where the linearized file is located

    System.String password

    password of the pdf content

    Returns
    Type Description
    System.Boolean

    Returns true if the file is linearized, otherwise returns false

    SaveAsJson(Byte[], String, String, QPdfJsonOptions)

    Saves PDF document as JSON file with custom options

    Declaration
    public void SaveAsJson(byte[] pdfBytes, string outputPath, string password, QPdfJsonOptions options)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes

    PDF document bytes

    System.String outputPath

    Output JSON file path

    System.String password

    PDF password if encrypted

    QPdfJsonOptions options

    JSON conversion options

    SaveAsJsonAsync(Byte[], String, String, QPdfJsonOptions)

    Async version of SaveAsJson with options

    Declaration
    public Task SaveAsJsonAsync(byte[] pdfBytes, string outputPath, string password, QPdfJsonOptions options)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes
    System.String outputPath
    System.String password
    QPdfJsonOptions options
    Returns
    Type Description
    System.Threading.Tasks.Task

    SaveAsLinearized(IDocumentId, String, String)

    Save PDF document as a linearized PDF file

    Declaration
    public void SaveAsLinearized(IDocumentId id, string path, string password)
    Parameters
    Type Name Description
    IronSoftware.Abstractions.Pdf.IDocumentId id

    id of the document

    System.String path

    path where the linearized file will be saved

    System.String password

    password of the pdf content

    SaveAsLinearized(Byte[], String, String)

    Save PDF document as a linearized PDF file

    Declaration
    public void SaveAsLinearized(byte[] pdfBytes, string path, string password)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes
    System.String path

    path where the linearized file will be saved

    System.String password

    password of the pdf content

    ToJson(Byte[], String, QPdfJsonOptions)

    Converts PDF document to JSON format with custom options

    Declaration
    public string ToJson(byte[] pdfBytes, string password, QPdfJsonOptions options)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes

    PDF document bytes

    System.String password

    PDF password if encrypted

    QPdfJsonOptions options

    JSON conversion options

    Returns
    Type Description
    System.String

    JSON string representation of the PDF

    ToJson(Byte[], String, TextWriter, QPdfJsonOptions)

    Converts PDF document to JSON format using TextWriter

    Declaration
    public void ToJson(byte[] pdfBytes, string password, TextWriter writer, QPdfJsonOptions options)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes

    PDF document bytes

    System.String password

    PDF password if encrypted

    System.IO.TextWriter writer

    TextWriter to write JSON to

    QPdfJsonOptions options

    JSON conversion options

    ToJson(Byte[], String, StringBuilder, QPdfJsonOptions)

    Converts PDF document to JSON format using StringBuilder

    Declaration
    public void ToJson(byte[] pdfBytes, string password, StringBuilder builder, QPdfJsonOptions options)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes

    PDF document bytes

    System.String password

    PDF password if encrypted

    System.Text.StringBuilder builder

    StringBuilder to append JSON to

    QPdfJsonOptions options

    JSON conversion options

    ToJsonAsync(Byte[], String, QPdfJsonOptions)

    Async version of ToJson with options

    Declaration
    public Task<string> ToJsonAsync(byte[] pdfBytes, string password, QPdfJsonOptions options)
    Parameters
    Type Name Description
    System.Byte[] pdfBytes
    System.String password
    QPdfJsonOptions options
    Returns
    Type Description
    System.Threading.Tasks.Task<System.String>

    Implements

    System.IDisposable
    ☀
    ☾
    Downloads
    • Download with Nuget
    • Start for Free
    In This Article
    Back to top
    Install with Nuget
    Want to deploy IronPDF to a live project for FREE?
    What’s included?
    30 days of fully-functional product
    Test and share in a live environment
    No watermarks in production
    Get your free 30-day Trial Key instantly.
    No credit card or account creation required
    Your Trial License Key has been emailed to you.
    Download IronPDF free to apply
    your Trial Licenses Key
    Install with NuGet View Licenses
    Licenses from $499. Have a question? Get in touch.