PdfTextCompression enumeration

PdfTextCompression enumeration

Specifies a type of compression applied to all content in the PDF file except images.

Members

NameDescription
NONENo compression.
FLATEFlate (ZIP) compression.

Examples

Shows how to apply text compression when saving a document to PDF.

doc = aw.Document()
builder = aw.DocumentBuilder(doc)
for i in range(100):
    builder.writeln('Lorem ipsum dolor sit amet, consectetur adipiscing elit, ' + 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.')
# Create a "PdfSaveOptions" object that we can pass to the document's "save" method
# to modify how that method converts the document to .PDF.
options = aw.saving.PdfSaveOptions()
# Set the "text_compression" property to "PdfTextCompression.NONE" to not apply any
# compression to text when we save the document to PDF.
# Set the "text_compression" property to "PdfTextCompression.FLATE" to apply ZIP compression
# to text when we save the document to PDF. The larger the document, the bigger the impact that this will have.
options.text_compression = pdf_text_compression
doc.save(ARTIFACTS_DIR + 'PdfSaveOptions.text_compression.pdf', options)

See Also