function SaveAsObjectStream(Stream: TStream; Option: TSaveOption = saNone; PdfVersion: TPdfVersion = pvUnknown; MaxObjectsPerStream: Integer = 100; MaxDecodedBytesPerStream: Integer = 65536): Boolean;
function SaveAsObjectStream(const FileName: string; Option: TSaveOption = saNone; PdfVersion: TPdfVersion = pvUnknown; MaxObjectsPerStream: Integer = 100; MaxDecodedBytesPerStream: Integer = 65536): Boolean;
| Stream | TStream that receives the complete object-stream PDF |
| FileName | Output path replaced only after a sibling temporary file succeeds |
| Option | Normal save option or saRemoveSecurity; saIncremental is rejected |
| PdfVersion | Output version from PDF 1.5 upward, or pvUnknown to preserve or upgrade the current version |
| MaxObjectsPerStream | Maximum object members per ObjStm group; the default is 100 |
| MaxDecodedBytesPerStream | Maximum decoded member payload per group; the default is 65536 bytes |
True when the object-stream output was completed successfullyThe method first uses the normal PDFium save path as the semantic source, then resolves the active classic, hybrid, or xref-stream revision
Existing object-stream members are materialised before references are renumbered into page-local order
Eligible non-stream objects are grouped by both member count and decoded payload size, then Flate-compressed only when compression reduces the group
The catalog, stream objects, signature dictionaries, indirect stream lengths, and oversized values remain directly addressable
A pure xref stream uses adaptive field widths and type-2 entries for every compressed member
saIncremental is not supported and existing digital signatures become invalidsaRemoveSecurity because object renumbering changes object-level encryption keys
// Balance compact output with bounded random-access decompression
Pdf.SaveAsObjectStream('report-compact.pdf', saNoIncremental, pv17, 100, 65536);