memory_optimization property
SaveOptions.memory_optimization property
Gets or sets value determining if memory optimization should be performed before saving the document.
Default value for this property is False
.
@property
def memory_optimization(self) -> bool:
...
@memory_optimization.setter
def memory_optimization(self, value: bool):
...
Remarks
Setting this option to True
can significantly decrease memory consumption while saving large documents at the cost of slower saving time.
Examples
Shows an option to optimize memory consumption when rendering large documents to PDF.
doc = aw.Document(file_name=MY_DIR + 'Rendering.docx')
# Create a "PdfSaveOptions" object that we can pass to the document's "Save" method
# to modify how that method converts the document to .PDF.
save_options = aw.saving.SaveOptions.create_save_options(save_format=aw.SaveFormat.PDF)
# Set the "MemoryOptimization" property to "true" to lower the memory footprint of large documents' saving operations
# at the cost of increasing the duration of the operation.
# Set the "MemoryOptimization" property to "false" to save the document as a PDF normally.
save_options.memory_optimization = memory_optimization
doc.save(file_name=ARTIFACTS_DIR + 'PdfSaveOptions.MemoryOptimization.pdf', save_options=save_options)
See Also
- module aspose.words.saving
- class SaveOptions