DynaPDF Manual - Page 549

Previous Page 548   Index   Next Page 550

Function Reference
Page 549 of 787
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, patterns, 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.
Besides content optimization it is also possible to flatten layers, scale or just re-compress images, or
to correct hairlines.
The parameter Flags is a bit mask. Multiple flags can be combined with a binary or operator, e.g.
ofInMemory | ofScaleImage.
The flag ofScaleImages will be ignored if the parameter Parms is set to NULL.
Optimize() does not rebuild font subsets like CheckConformance(). The function is part of DynaPDF
Professional.
Usage
It is assumed that this function is called right before closing the PDF file. It is not allowed to call the
function twice for the same PDF file in memory.
After Optimize() was executed, close the file with CloseFile(), CloseFileEx(), or CloseAndSignFile()
for example.
If the flag ofInMemory is absent, then pages are directly written to the output file after optimization
to reduce the memory usage. If the PDF file was created in memory (this is the case if no ouput file
name was passed to CreateNewPDF()) then the output file must be opened with OpenOutputFile()
or OpenOutputFileEncrypted() beforehand. Note that it is not possible to sign the PDF file if the flag
ofInMemory is absent.
If the file should be signed too, then import the resulting PDF file again and sign it with
CloseAndSignFile() or CloseAndSignFileEx() for example.
 

Previous topic: Optimize

Next topic: Re-compressing 1 bit images with JBIG2, Text to outline conversion, Color conversion, Converting gray images to 1 bit (black & white)

Start Chat