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
This example produces incorrect output:
const char attr[] = "\"BBox\":[50 450 200 500]\"Placement\"\"Inline\""; // Wrong!
/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.
LBOOL pdfOptimize(
const PPDF* IPDF,
// Instance pointer
TOptimizeFlags Flags,
// See below
struct TOptimizeParams* Parms) // Can be NULL, see desciption below
typedef enum
= 0x00000000, // Just rebuild the content streams.
= 0x00000001, // Optimize the file fully in memory.
= 0x00000002, // If set, Separation, DeviceN, and NChannel color spaces
// will be converted to the device space.
= 0x00000004, // If set, ICCBased color spaces will be left unchanged.
= 0x00000008, // Scale images.
= 0x00000010, // Meaningful only if ofScaleImages is set. If set, don't
// scale images with a color mask.
= 0x00000020, // If set, rename all object links to short names.
= 0x00000040, // Delete invisible paths. An invisible path is a path that
// was finished with the no-op operator "n".
= 0x00000080, // Flatten layers if any.
= 0x00000100, // Delete private data from pages, templates, and images.
= 0x00000200, // No need to embed thumbnails (can be created on demand).
ofDeleteAlternateImages = 0x00000400, // If set, alternate images will be deleted if any.
= 0x00000800, // Meaningful only if ofScaleImages is set. If set, do not
// check whether the scaled image is smaller.
= 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