Back to Devexpress

PdfSaveOptions.UseObjectStreams Property

officefileapi-devexpress-dot-pdf-dot-pdfsaveoptions-27afdc45.md

latest2.6 KB
Original Source

PdfSaveOptions.UseObjectStreams Property

Gets or sets whether to store PDF objects in object streams.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Pdf.v25.2.Core.dll

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public bool UseObjectStreams { get; set; }
vb
Public Property UseObjectStreams As Boolean

Property Value

TypeDescription
Boolean

true to store PDF objects in object streams; otherwise, false.

|

Remarks

Object streams (PDF 1.5+) allow you to pack multiple PDF objects into a compressed stream to reduce file size.

Set the UseObjectStreams property to true and pass the PdfSaveOptions object to the SaveDocument method to enable object stream compression.

Note

Object streams are not used if they are prohibited by the specified compliance. Among supported compliance standards, only PDF/A-1 (based on PDF 1.4) prohibits object streams.

The following code snippet enables object streams when saving a PDF document:

csharp
using DevExpress.Pdf;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
    // Load the document
    processor.LoadDocument("Document.pdf");

    // Configure save options with object streams
    var saveOptions = new PdfSaveOptions() {
        UseObjectStreams = true
    };

    // Save the document with object streams enabled
    processor.SaveDocument("Document.compressed.pdf", saveOptions);
}
vb
Imports DevExpress.Pdf

Using processor As New PdfDocumentProcessor()
    ' Load the document
    processor.LoadDocument("Document.pdf")

    ' Configure save options with object streams
    Dim saveOptions As New PdfSaveOptions() With {
        .UseObjectStreams = True
    }

    ' Save the document with object streams enabled
    processor.SaveDocument("Document.compressed.pdf", saveOptions)
End Using

See Also

PdfSaveOptions Struct

PdfSaveOptions Members

DevExpress.Pdf Namespace