The function rPdfOptAddCommandStr of RecPDF Module uses command strings for setting up the optimization process. The below lists show the possible command strings.
- Note
- The command strings are case-sensitive.
The structure of a command string:
CommandStr[:Specifier[:Exact Value]]
The below lists show the CommandStr
in bold. Sublists show the Specifier
s if any, and the possible Exact Value
s are also shown where they can be used.
Basic functions
- XRef - Compress the XRef structure.
- CompressObjects - Compress the uncompressed data objects.
- ZIPStreams - Use Zip compression instead of LZW.
- Linearize - Optimize for fast web view.
Set the version of the PDF
- PDF13 - Convert to 1.3
- PDF14 - Convert to 1.4
- PDF15 - Convert to 1.5
- PDF16 - Convert to 1.6
- PDF17 - Convert to 1.7
Tag handling
- RemoveTags - Remove the tags from the PDF.
Font handling
- SubsetFonts - Subset all embedded fonts.
Security
- NoSec - Remove security.
- Sec40 - Protect with 40 bit RC4 encryption.
- Sec128 - Protect with 128 bit RC4 encryption.
- Sec128AES - Protect with 128 bit AES encryption.
- Sec256 - Protect with 256 bit AES encryption.
- OwnerPassword - Set the owner password. Separate the password with
':'
! E.g.: OwnerPassword:123A24d
- Restrictions - Set the security restrictions. Separate the integer value of the combined restriction flags with
':'
! Use the flags of RPDF_RESTRICTIONS. E.g. for disabling printing and changing: Restrictions:8448
Image compression
- BWImages - Set the compression of the black and white images. Possible specifiers:
- CCITTFax - Group4 compression.
- JBIG2 - JBIG2 compression. Possible exact values: 1...100
- GrayImages - Set the compression of the grayscale images. Possible specifiers:
- JPEG - JPEG compression. Possible exact values: 1...100
- JPEG2000 - JPEG2000 compression. Possible exact values: 1...100
- ZIP - Zip compression.
- ColorImages - Set the compression of the color images. Possible specifiers:
- JPEG - JPEG compression. Possible exact values: 1...100
- JPEG2000 - JPEG2000 compression. Possible exact values: 1...100
- ZIP - Zip compression.
Colorspace conversions
- ImagesToBW - Convert all images to black and white.
- ImagesToGray - Convert color images to grayscale.
- ConvertToGray - Convert all PDF content to grayscale.
Metadata handling
- MetaAdd - Add metadata entry. E.g:
MetaAdd:dc:title:TITLE
MetaAdd:dc:creator:AUTHOR
MetaAdd:dc:description:SUBJECT
MetaAdd:pdf:producer:PRODUCER
MetaAdd:pdf:Keywords:KYWRD1
, KYWRD2
MetaAdd:xmp:creatortool:
CREATORTOOL
- MetaRemove - Remove metadata entry. E.g:
MetaRemove:dc:title
MetaRemove:dc:creator
Sample code fragment
#include "RecPDF.h"
rPdfOpen(strInpFileName, NULL, &rpdf_h);
RECERR PDFASMAPI rPdfOpen(LPCTSTR pFileName, LPCTSTR password, RPDF_DOC *handle)
Open a PDF file.
struct tagRPDF_DOC * RPDF_DOC
Handle of a PDF document.
Definition recpdf.h:48
RECERR PDFASMAPI rPdfInit(void)
Initialize the RecPDF.
RECERR PDFASMAPI rPdfOptAddCommandStr(RPDF_DOC handle, LPCTSTR command)
Add an optimization command string to a handle.
RECERR PDFASMAPI rPdfOptimize(RPDF_DOC handle, LPCTSTR pOptFileName)
Do the optimization process.
RECERR PDFASMAPI rPdfClose(RPDF_DOC handle)
Close a PDF document.