Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
General document methods
Abort
Aborted
AddColorTransformationRule
AddImageFromBitmapHandle
AddImageFromBuffer
AddImageFromFile
AddImageFromFilename
AddImageFromMemory
AddImageWithColorMask
AddImageWithMask
AddTTFFontFromFile
AddTTFFontFromFile2
AddType1FontFromFile
AutoCreateURL
AutoLaunch
BeginDoc
BinaryImage
Compression
CreateWaterMark
CurrentWaterMarkIndex
DocumentInfo_Author
DocumentInfo_CreationDate
DocumentInfo_Creator
DocumentInfo_Keywords
DocumentInfo_Producer
DocumentInfo_Subject
DocumentInfo_Title
EndDoc
FileName
FlipImage
FontEmbedStyle
GenerateInMemoryFile
GetCurrentPageIndex
GetImageCount
GetImageHeight
GetImageResolution
GetImageWidth
GetUsedDC
GetUsedDCResolution
GlyphsToUnicodeStr
HDC
InitialZoom
InitialZoom2
JPEGQuality
LastError
LoadICCProfile
LogActionsAndErrors
LogTextOperation
MakeImageGrayScale
MakeImageNegative
MemoryFileSize
MetafileImagesCompressionType
MetafileImagesJpegCompression
NewPage
NonEmbeddedFonts
NonEmbeddedFonts_Add
NotEmbedAnyFonts
OnePass
OutputByteStream
OwnerPassword
PageCount
PageHeight
PageLayout
PageMode
PageNumber
PageWidth
PlaceImageToCurrentPage
PlayEMF
PrinterForVirtualDC
Printing
ProducePDFA
ProtectionEnabled
ProtectionKeyLength
ProtectionOptions_coAssembly
ProtectionOptions_coCopyInformation
ProtectionOptions_coExtractInfo
ProtectionOptions_coFillAnnotation
ProtectionOptions_coModifyAnnotation
ProtectionOptions_coModifyStructure
ProtectionOptions_coPrint
ProtectionOptions_coPrintHigh
Resolution
SetCurrentPage
SetPDFAOutputIntent
SetPDFXOutputIntent
StartEngine
SwitchedToWatermark
TransformColors
UseCurrentDocumentResolutionForNextPages
UserPassword
UseScreenDC
Version
ViewerPreferences_vpCenterWindow
ViewerPreferences_vpFitWindow
ViewerPreferences_vpHideMenuBar
ViewerPreferences_vpHideToolBar
ViewerPreferences_vpHideWindowUI
Collapse All

This property gets or sets the value indicating whether PDF page streams are compressed or not.

Syntax

TxCompressionType Compression { get; set; }
Value
One of the TxCompressionType values.

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 the FontEmbedStyle property to fetNotEmbed.

Equivalent 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

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots