TdxPDFDocument.SaveToStream(TStream,Boolean,Boolean) Method
Saves the document to a stream.
Declaration
procedure SaveToStream(AStream: TStream; AAllowSignatureRemoval: Boolean = False; AResetModified: Boolean = True);
Parameters
Name | Type | Description |
---|---|---|
AStream | TStream | The target stream object. |
AAllowSignatureRemoval | Boolean | Optional. If |
AResetModified | Boolean | Optional. If |
Remarks
Call this procedure to save all changes made in the document. A SaveToStream
procedure call raises the OnSaveProgress event multiple times, every time certain PDF objects in the document are successfully saved. The number of event occurrences depends on the size and complexity of the document.
The SaveToStream
procedure can:
- Apply a single digital signature to the saved document if the SignatureOptions.Enabled property is set to
True
and the active digital signature is configured. - Encrypt the document and add password protection if the SecurityOptions.Enabled property is set to
True
, and a password is assigned to the SecurityOptions.UserPassword property.
The SaveToStream
procedure cannot save a document with multiple digital signatures or preserve a loaded signature. If the source document has one or more digital signatures, a SaveToStream
procedure call raises the EdxPDFException exception that shows the following message: “The document has a digital signature and cannot be saved. To remove the signature and save the document, call the method again and pass True
as the AAllowSignatureRemoval
parameter.” Follow the instructions in the message to avoid this exception and save the document without imported digital signatures.
Important
The current SaveToStream
procedure implementation cannot use the AES encryption algorithm to protect a saved document and raises the EdxPDFEncryptionException exception if the SecurityOptions.Algorithm property is set to eatAES
and the SecurityOptions.Enabled property is set to True
. Unlike SaveToStream
, the LoadFromStream procedure can load documents encrypted with the AES algorithm.