TxCompressionType Compression { get; set; } |
A compressed file is always smaller; however, it contains binary data rather than ASCII data. In addition, "run-length" compression (uncompressed file) is compatible with older PDF reader programs.
You can also reduce output file size by setting the FontEmbedStyle property to fetNotEmbed.
Equivalent in new interface: IPDFDocument4::Compression.
{ PDF object is supposed to be created } PDF.Compression := ctFlate; { the size of the PDF file generated would be: } { about 7 Kb if Compression = ctFlate } { about 14 Kb if Compression = ctNone } PDF.BeginDoc; PDF.PDFPAGE_SetActiveFont('Verdana', false, false, false, false, 8.0, 0); string line := 'This is a long text line. This is a long text line.'; for i := 1 to 100 do begin PDF.PDFPAGE_TextOut(10, i*10, 0.0, line); end; PDF.EndDoc();
// PDF object is supposed to be created PDF->Compression = ctFlate; // the size of the PDF file generated would be: // about 7 Kb if Compression = ctFlate // about 14 Kb if Compression = ctNone PDF->BeginDoc(); PDF->PDFPAGE_SetActiveFont("Verdana", FALSE, FALSE, FALSE, FALSE, 8.0, 0); CHAR* line = "This is a long text line. This is a long text line."; for (int i = 0; i < 100; i++) PDF->PDFPAGE_TextOut(10, (i+1)*10, 0.0, line); PDF->EndDoc();
// PDF object is supposed to be created PDF.Compression = TxCompressionType.ctFlate; // the size of the PDF file generated would be: // about 7 Kb if Compression = ctFlate // about 14 Kb if Compression = ctNone PDF.BeginDoc(); PDF.PDFPAGE_SetActiveFont("Verdana", false, false, false, false, 8.0, 0); string line = "This is a long text line. This is a long text line."; for (int i = 0; i < 100; i++) PDF.PDFPAGE_TextOut(10, (i+1)*10, 0.0, line); PDF.EndDoc();
' PDF object is supposed to be created PDF.Compression = 1 ' the size of the PDF file generated would be: ' about 7 Kb if Compression = ctFlate (1) ' about 14 Kb if Compression = ctNone (0) PDF.BeginDoc PDF.PDFPAGE_SetActiveFont "Verdana", False, False, False, False, 8.0, 0 line = "This is a long text line. This is a long text line." For i = 1 To 100 PDF.PDFPAGE_TextOut 10, i*10, 0.0, line Next PDF.EndDoc