Saves a highly-compressed PDF document to a file on disk.
Declaration:
|
Copy Code
|
AT_ERRCOUNT ACCUAPI IG_PDF_save_compressed(
HMIGEAR hMPIDoc,
LPSTR lpFileName
);
|
Arguments:
hMPIDoc |
HMIGEAR |
A handle to an opened PDF document. |
lpFileName |
LPSTR |
A file path to save the compressed PDF document. |
Return Value:
The number of ImageGear errors that occurred.
Remarks:
ImageGear for C/C++ improves the overall size of saved PDF documents by reducing or removing data structures in the PDF document, specifically:
- Re-compress embedded bitonal Images to use lossless JBIG2 compression, which offers superior compression to either Flate or CCITTFax compression.
- Re-compress embedded gray and color Images to use lossy sequential JPEG compression.
- Re-compress LZW compressed Streams to use Flate compression.
- Remove ASCII85 compression from Streams.
- Compress uncompressed Streams to use Flate compression.
- Optimize content Streams to share common sub-sequences.
- Downsample high-resolution images, which may result reduce image quality when displayed zoomed-in.
- Remove Thumbnail Images of PDF pages.
- Remove embedded Standard Type 1 Fonts.
- Merge identical Font descriptors and encodings.
- Merge identical Forms and Images.
- Remove symbols specific to deleted images from JBIG2 dictionaries.
- Remove any unused Objects.
WARNING:
- Re-compressing Images with JBIG2 will invalidate PDF/X compliant documents.
- Removing embedded Standard Type 1 Fonts will invalidate PDF/X compliant documents.
- Removing embedded Standard Type 1 Fonts will invalidate PDF/A compliant documents when visible text is affected.
File size improvements will vary with each PDF file. In some cases, file size reduction is dramatic. Re-saving an optimized PDF file is not expected to further reduce its size. In rare instances, PDF file size may increase due to metadata that is always written when PDF documents are saved.
Example:
C and C++ |
Copy Code
|
HMIGEAR pdfDocument;
IG_mpi_create(&pdfDocument, 0);
IG_mpi_file_open(lpInputFile, pdfDocument, IG_FORMAT_PDF, IG_MP_OPENMODE_READONLY);
AT_ERRCOUNT nErr = IG_PDF_save_compressed(document, lpOutputFile);
IG_mpi_delete(document);
|