DynaPDF Manual - Page 585

Previous Page 584   Index   Next Page 586

Function Reference
Page 585 of 839
The above examples produce all exactly the same output:
/A<</BBox[50 450 200 500]/Placement/Inline/O/Layout>>
Note that the /O key is added by DynaPDF if not already present. The missing right or left braces in
the third and fourth example cause no error or warning. As described earlier, outer braces are
ignored.
This example produces incorrect output:
const char attr[] = "\"BBox\":[50 450 200 500]\"Placement\"\"Inline\""; // Wrong!
Result:
/A<</BBox[50 450 200 500]/Placement(Inline)/O/Layout>>
The problem is that the value of the /Placement key must be a name object. The JSON parser knows
that a PDF key is always a name object. Therefore, the function converts a key defined as string
automatically to a name object. However, the value of a key can be a name, string, boolean, array,
dictionary, null, or a number. The PDF Standard specifies which data type a key accepts. In this
particular case, the /Placement key requires a name object as value. The function does not know
whether the value of an arbitrary key is valid.
Return values:
If the function succeeds the return value is 1. If the function fails the return value is zero.
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).
 

Previous topic: OpenTagBBox, OpenTagEx

Next topic: Usage