PDF Creator Pilot documentation |
Download CHM version of this manual. |
|
![]() ![]() Collapse AllGets or sets value indicating whether PDF page streams are compressed or not.
|
| TxCompressionType Compression { get; set; } |
Value
Remarks
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 FontEmbedStyle property to fetNotEmbed.
Analogue in new interface: IPDFDocument4::Compression.
Example
How to compress the document
Delphi
[copy to clipboard]
{ 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();
C/C++
[copy to clipboard]
// 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();
C#
[copy to clipboard]
// 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();
Visual Basic
[copy to clipboard]
' 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
See Also


