Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 520

Previous Page 519   Index   Next Page 521

Function Reference
Page 520 of 750
Optimize
Syntax:
LBOOL pdfOptimize(
const PPDF* IPDF,
// Instance pointer
TOptimizeFlags Flags,
// See below
struct TOptimizeParams* Parms) // Can be NULL, see desciption below
typedef enum
{
ofDefault
= 0x00000000, // Just rebuild the content streams.
ofInMemory
= 0x00000001, // Optimize the file fully in memory.
ofConvertAllColors
= 0x00000002, // If set, Separation, DeviceN, and NChannel color spaces
// will be converted to the device space.
ofIgnoreICCBased
= 0x00000004, // If set, ICCBased color spaces will be left unchanged.
ofScaleImages
= 0x00000008, // Scale images.
ofSkipMaskedImages
= 0x00000010, // Meaningful only if ofScaleImages is set. If set, don't
// scale images with a color mask.
ofNewLinkNames
= 0x00000020, // If set, rename all object links to short names.
ofDeleteInvPaths
= 0x00000040, // Delete invisible paths. An invisible path is a path that
// was finished with the no-op operator "n".
ofFlattenLayers
= 0x00000080, // Flatten layers if any.
ofDeletePrivateData
= 0x00000100, // Delete private data from pages, templates, and images.
ofDeleteThumbnails
= 0x00000200, // No need to embed thumbnails (can be created on demand).
ofDeleteAlternateImages = 0x00000400, // If set, alternate images will be deleted if any.
ofNoImageSizeCheck
= 0x00000800
// Meaningful only if ofScaleImages is set. If set, do not
// check whether the scaled image is smaller.
ofIgnoreZeroLineWidth
= 0x00001000
// Meaningful only if the parameter MinLineWidth of the
// TOptimizeParams structure is greater zero.
// If set, ignore line width operators with a value of zero
// (zero means one device unit).
ofAdjZeroLineWidthOnly
= 0x00002000
// Meaningful only if the parameter MinLineWidth of the
// TOptimizeParams structure is greater zero. If set, change
// the line width of real hairlines only (a hairline is a
// one pixel width line -> LineWidth == 0).
}TOptimizeFlags;
struct TOptimizeParams
{
UI32
StructSize;
// Must be set to sizeof(TOptimizeParams).
UI32
Min1BitRes;
// Minimum resolution before scaling.
UI32
MinGrayRes;
// Minimum resolution before scaling.
UI32
MinColorRes;
// Minimum resolution before scaling.
UI32
Res1BitImages;
// 1 bit black & white images.
UI32
ResGrayImages;
// Gray images.
UI32
ResColorImages; // Multi-channel images.
TCompressionFilter Filter1Bit;
// Filter for black & white images.
TCompressionFilter FilterGray;
// Filter for gray images.
TCompressionFilter FilterColor;
// Filter for multi-channel images.
SI32
JPEGQuality;
// JPEG quality.
SI32
JP2KQuality;
// JPEG 2000 quality.
float
MinLineWidth;
// Zero means no hair line removal.
};
The function rebuilds the content streams of all pages, templates, annotations, and form fields.
Useless operators as well as errors in content streams will be fully removed. The resulting content
streams are error free and usually smaller. How much the optimization takes effect depends on the
quality of the original content streams.
 

Previous topic: OpenTag

Next topic: Image scaling