|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pdftools.NativeLibrary
com.pdftools.pola.PdfOptimize
public class PdfOptimize
The purpose of the PDF Image Optimization API is to adjust embedded raster images in a PDF to the specific needs, such as reducing the resolution for fast viewing via the web, or converting colors for printing.
| Nested Class Summary |
|---|
| Field Summary |
|---|
| Fields inherited from class com.pdftools.NativeLibrary |
|---|
VERSION |
| Constructor Summary | |
|---|---|
PdfOptimize()
Simple Constructor |
|
PdfOptimize(byte[] pData,
java.lang.String strPassword)
Deprecated. Deprecated in Version 4.7. Use PdfOptimize() and
openMem(byte[], String) instead. |
|
PdfOptimize(java.lang.String strPath,
java.lang.String strPassword)
Deprecated. Deprecated in Version 4.7. Use PdfOptimize() and
open(String, String) instead. |
|
| Method Summary | |
|---|---|
boolean |
close()
Closes the currently open input file(s). |
void |
destroyObject()
Release handle for the process. |
int |
getBitonalCompression()
Deprecated. Deprecated in Version 4.6. Use getBitonalCompressions() instead. |
int |
getBitonalCompressions()
Get the compression types for bi-tonal (black and white) images. |
float |
getBitonalResolutionDPI()
Get the target resolution in dots per inch (DPI) after re-sampling images for bi-tonal images. |
float |
getBitonalThresholdDPI()
Get the threshold resolution in dots per inch (DPI) for bi-tonal images. |
boolean |
getClipImages()
Get whether invisible parts of images are clipped (cropped). |
int |
getColorCompression()
Deprecated. Deprecated in Version 4.6. Use getContinuousCompressions() instead. |
int |
getColorConversion()
Get the color conversion to use on color images, see NativeLibrary.COLORCONVERSION. |
float |
getColorResolutionDPI()
Get the target resolution in dots per inch (DPI) after re-sampling images for color images. |
float |
getColorThresholdDPI()
Get the threshold resolution in dots per inch (DPI) for color images. |
int |
getCompressionQuality()
Deprecated. Use getImageQuality() instead. |
int |
getContinuousCompressions()
Get the compression types to be tried for continuous images, i.e. |
boolean |
getConvertToCFF()
Get whether embedded Type1 (PostScript) fonts shall be converted to Type1C (Compact Font Format). |
int |
getDitheringMode()
Get whether dithering is enabled or disabled when down-sampling bi-tonal images. |
int |
getErrorCode()
Get the latest error code. |
boolean |
getExtractFonts()
Get the switch to extract the embedded fonts. |
boolean |
getExtractImages()
Get whether images are extracted. |
boolean |
getFlattenSignatureFields()
Get whether appearances of signature fields are flattened. |
boolean |
getForceCompressionTypes()
Get whether image re-compression is forced if an image in the input PDF has a compression type that differs from the compression types given in setContinuousCompressions(int),
setBitonalCompressions(int), or
setIndexedCompressions(int). |
boolean |
getForceRecompression()
Get whether images are always re-compressed using the specified image compression and other image parameters. |
int |
getImageQuality()
Get the quality index of the lossy compression. |
boolean |
getImageStratConserv()
Deprecated. Deprecated in Version 4.7. Get the switch for the conservative image processing strategy: Only try re-compressing an image if it has either been clipped ( setClipImages(boolean)), re-sampled (
setResolutionDPI(float), setThresholdDPI(float)), or if
it has undergone a color conversion (setColorConversion(int)),
or if setForceRecompression(boolean) is enabled. Otherwise the
original input image is taken as is. |
int |
getIndexedCompressions()
Get the compression types for images that have an indexed ("palette") color space. |
static boolean |
getLicenseIsValid()
Check if a valid license is loaded. |
boolean |
getLinearize()
Get whether the PDF output file will be linearized, i.e. |
boolean |
getMergeEmbeddedFonts()
Get the switch to merge embedded font programs. |
int |
getMonochromeCompression()
Deprecated. Deprecated in Version 4.6. Use getContinuousCompressions() instead. |
float |
getMonochromeResolutionDPI()
Get the target resolution in dots per inch (DPI) after re-sampling images for monochrome images. |
float |
getMonochromeThresholdDPI()
Get the threshold resolution in dots per inch (DPI) for monochrome images. |
int |
getMrcLayerCompression()
Get the compression type for MRC foreground and background layers. |
int |
getMrcLayerQuality()
Get the image quality for MRC foreground and background layers when using a lossy compression type. |
float |
getMrcLayerResolutionDPI()
Get the target resolution in DPI for down-sampling MRC foreground and background layers. |
int |
getMrcMaskCompression()
Get the compression type for MRC masks. |
int |
getMrcPictCompression()
Get the compression type for MRC cut-out pictures. |
boolean |
getMrcRecognizePictures()
Get the option to recognize areas of photographic pictures when doing MRC. |
boolean |
getOptimizeResources()
Get whether resources shall be optimized. |
int |
getPageCount()
Get the number of total pages of the input document. |
byte[] |
getPdf()
Get the PDF output file previously stored in memory. |
static java.lang.String |
getProductVersion()
Get the version of the product |
boolean |
getReduceColorComplexity()
Get whether the color complexity of images is reduced. |
boolean |
getRemoveImages()
Get whether images are removed. |
boolean |
getRemoveNonSymbolicFonts()
Deprecated. Deprecated in Version 4.7. |
boolean |
getRemoveReduntantObjects()
Get whether redundant objects shall be removed. |
boolean |
getRemoveStandardFonts()
Get whether the font programs of all embedded standard fonts shall be removed, such as Arial, Courier, CourierNew, Helvetica, Symbol, Times, TimesNewRoman and ZapfDingbats. |
float |
getResolutionDPI()
Get the target resolution in dots per inch (DPI) after re-sampling images. |
int |
getStrip()
Get the stripping mode: This mode can be configured to remove unneeded data of a PDF document such as Threads, Metadata, the PieceInfo, the StructTreeRoot entry, embedded Thumbs and the SpiderInfo entry. |
boolean |
getSubsetFonts()
Get whether embedded fonts are subset and embedded font programs of different subsets of the same font merged. |
float |
getThresholdDPI()
Get the threshold resolution in DPI above which images are re-sampled. |
static boolean |
linearizeFile(java.lang.String strInFileName,
java.lang.String strPassword,
java.lang.String strOutFileName,
java.lang.String strUserPw,
java.lang.String strOwnerPw,
int iPermissionFlags)
Linearize a PDF file and save the result as a new PDF file, which is optimized for fast web view. |
boolean |
listFonts(java.lang.String strFileName)
List all fonts included in the document and write them as a list to a text file. |
boolean |
listImages(java.lang.String strFileName)
List all images included in the document and write them as a list to a text file. |
boolean |
open(java.lang.String strPath,
java.lang.String strPassword)
Open a PDF file, i.e. |
boolean |
openMem(byte[] pData,
java.lang.String strPassword)
Open an input PDF memory block, i.e. |
boolean |
renameFont(java.lang.String strFontName1,
java.lang.String strFontName2)
Deprecated. |
boolean |
saveAs(java.lang.String strpath,
java.lang.String strUserPw,
java.lang.String strOwnerPw,
int iPermissionFlags)
Create an output PDF document and store the optimized input file. |
boolean |
saveInMemory()
Save the output PDF in memory. |
void |
setBitonalCompression(int iCompression)
Deprecated. Deprecated in Version 4.6. Use setBitonalCompressions(int) instead. |
void |
setBitonalCompressions(int iCompression)
Set the compression types for bi-tonal (black and white) images. |
void |
setBitonalResolutionDPI(float fResolutionDPI)
Set the target resolution in dots per inch (DPI) after re-sampling images for bi-tonal images. |
void |
setBitonalThresholdDPI(float fThresholdDPI)
Set the threshold resolution in dots per inch (DPI) to selectively activate re-sampling for bi-tonal images. |
void |
setClipImages(boolean bClip)
Clip invisible parts of images. |
static boolean |
setCMSEngine(java.lang.String sCMSEngine)
Set the name of the Color Management System (CMS) engine (None, Neugebauer, lcms or a filename). |
void |
setColorCompression(int iCompression)
Deprecated. Deprecated in Version 4.6. Use setContinuousCompressions(int) instead. |
void |
setColorConversion(int iColorConversion)
Set the color conversion to use on color images. |
void |
setColorResolutionDPI(float fResolutionDPI)
Set the target resolution in dots per inch (DPI) after re-sampling images for color images. |
void |
setColorThresholdDPI(float fThresholdDPI)
Set the threshold resolution in dots per inch (DPI) to selectively activate re-sampling for color images. |
void |
setCompressionQuality(int iQuality)
Deprecated. Use setImageQuality(int) instead. |
void |
setContinuousCompressions(int iCompression)
Set the compression types to be tried for continuous images, i.e. |
void |
setConvertToCFF(boolean bConvertToCFF)
Set the switch to convert embedded Type1 (PostScript) fonts to Type1C (Compact Font Format). |
void |
setDitheringMode(int iDithering)
Enable or disable dithering when down-sampling bi-tonal images. |
void |
setExtractFonts(boolean bExtract)
Set the switch to extract the embedded fonts. |
void |
setExtractImages(boolean bExtract)
Images can be extracted to individual image files during processing of the PDF file. |
void |
setFlattenSignatureFields(boolean bFlatten)
A signature in a PDF consist of two parts: The invisible digital signature in the PDF The visual appearance that was attributed to the signature Part 1 can be used by a viewing application, to verify that a document has not changed since it has been signed and report this to the user. |
void |
setForceCompressionTypes(boolean bForce)
Set the switch to force re-compression of images if an image in the input PDF has a compression type that differs from the compression types given in setContinuousCompressions(int),
setBitonalCompressions(int), or
setIndexedCompressions(int). |
void |
setForceRecompression(boolean bForce)
Set the switch to always re-compress images using the specified image compression and other image parameters. |
void |
setImageQuality(int iQuality)
Set the quality index of the lossy compression. |
void |
setImageStratConserv(boolean bForce)
Deprecated. Deprecated in Version 4.7. Set the switch for the conservative image processing strategy: Only try re-compressing an image if it has either been clipped ( setClipImages(boolean)), re-sampled (
setResolutionDPI(float), setThresholdDPI(float)), or if
it has undergone a color conversion ( setColorConversion(int)),
or if setForceRecompression(boolean) is enabled. Otherwise the
original input image is taken as is. |
void |
setIndexedCompressions(int iCompression)
Set the compression types for images that have an indexed ("palette") color space. |
boolean |
setInfoEntry(java.lang.String sKey,
java.lang.String sValue)
Set the value of an info entry key. |
static boolean |
setLicenseKey(java.lang.String licenseKey)
Set the license key. |
void |
setLinearize(boolean bLinearize)
Set whether to linearize the PDF output file, i.e. |
void |
setMergeEmbeddedFonts(boolean bSubset)
Set the switch to merge embedded font programs. |
void |
setMonochromeCompression(int iCompression)
Deprecated. Deprecated in Version 4.6. Use setContinuousCompressions(int) instead. |
void |
setMonochromeResolutionDPI(float fResolutionDPI)
Set the target resolution in dots per inch (DPI) after re-sampling images for monochrome images. |
void |
setMonochromeThresholdDPI(float fThresholdDPI)
Set the threshold resolution in dots per inch (DPI) to selectively activate re-sampling for monochrome images. |
void |
setMrcLayerCompression(int iCompression)
Set the compression type for MRC foreground and background layers. |
void |
setMrcLayerQuality(int iQuality)
Set the image quality for MRC foreground and background layers when using a lossy compression type. |
void |
setMrcLayerResolutionDPI(float fResolutionDPI)
Set the target resolution in DPI for down-sampling MRC foreground and background layers. |
void |
setMrcMaskCompression(int iCompression)
Set the compression type for MRC masks. |
void |
setMrcPictCompression(int iCompression)
Set the compression type for MRC cut-out pictures. |
void |
setMrcRecognizePictures(boolean bRecognize)
Set the option to recognize areas of photographic pictures when doing MRC. |
void |
setOptimizeResources(boolean bOptimize)
Set whether resources should be optimized. |
void |
setProfile(int iProfile)
Set the optimization profile. |
void |
setReduceColorComplexity(boolean bClip)
Convert images to their least complex color space. |
void |
setRemoveImages(boolean bClip)
Remove images. |
void |
setRemoveNonSymbolicFonts(boolean bRemove)
Deprecated. Deprecated in Version 4.7. |
void |
setRemoveRedundantObjects(boolean bRemove)
Set whether redundant objects should be removed. |
void |
setRemoveStandardFonts(boolean bRemove)
Set whether to remove the font programs of all embedded standard fonts, such as Arial, Courier, CourierNew, Helvetica, Symbol, Times, TimesNewRoman and ZapfDingbats. |
void |
setResolutionDPI(float fResolutionDPI)
Set the target resolution in dots per inch (DPI) after re-sampling images. |
void |
setStrip(int iStripModes)
Set the stripping mode: This mode can be configured to remove unneeded data of a PDF document such as Threads, Metadata, the PieceInfo, the StructTreeRoot entry, embedded Thumbs and the SpiderInfo entry. |
void |
setSubsetFonts(boolean bSubset)
Subset embedded fonts and merge embedded font programs of different subsets of the same font, granted they can be merged. |
void |
setThresholdDPI(float fThresholdDPI)
Set the threshold in DPI to selectively activate re-sampling. |
boolean |
setVersion(java.lang.String strVersion)
Set the minimum PDF version of the created PDF output file. |
boolean |
unembedFont(java.lang.String strFontName)
Remove an embedded font program. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PdfOptimize()
public PdfOptimize(java.lang.String strPath,
java.lang.String strPassword)
PdfOptimize() and
open(String, String) instead.
strPath - the file path of the existing PDF residing in the file systemstrPassword - the password to be used to decrypt a password protected input
PDF
public PdfOptimize(byte[] pData,
java.lang.String strPassword)
PdfOptimize() and
openMem(byte[], String) instead.
pData - the memory block containing the PDF file given as a one
dimensional byte arraystrPassword - the password to be used to decrypt a password protected input
PDF| Method Detail |
|---|
public static boolean setLicenseKey(java.lang.String licenseKey)
licenseKey - The license key
true if the license is valid.public static boolean getLicenseIsValid()
true if a valid license is loaded.public static java.lang.String getProductVersion()
public static boolean setCMSEngine(java.lang.String sCMSEngine)
"None": If this switch is set to none then the algorithms specified in the PDF reference are used. This results in the maximum possible contrast.
"Neugebauer": The Neugebauer algorithm efficiently converts CMYK to RGB. It does not need any color profiles. The results, however, look similar to conversion using color profiles.
"lcms" (default): Use ICC color profiles. Default profiles are used for all unmanaged device color spaces.
FileName: Providing a file name, a configurable version of the Neugebauer algorithm is applied. The coefficients can be defined in the text file. The Neugebauer algorithm mixes the colors based on the amount of color and the corresponding weighted coefficient. Altering the values for a pure color specifically changes the result for this pure color. The color transition remains smooth.
sCMSEngine - Name of the CMS Engine
true on successpublic void destroyObject()
public boolean open(java.lang.String strPath,
java.lang.String strPassword)
strPath - the file path of the existing PDF residing in the file systemstrPassword - the user or owner password to be used to decrypt a password
protected input PDF. If this parameter is left out an empty
string is used as a default.
true: The file could be successfully opened.
false: The file does not exist, it is corrupt, or
the password is not valid. Use getErrorCode() for
additional information.
public boolean openMem(byte[] pData,
java.lang.String strPassword)
pData - the memory block containing the PDF file given as a one
dimensional byte arraystrPassword - the user or owner password to be used to decrypt a password
protected input PDF. If this parameter is left out an empty
string is used as a default.
true: The file could be successfully opened.
false: The file does not exist, it is corrupt, or
the password is not valid.
public boolean saveAs(java.lang.String strpath,
java.lang.String strUserPw,
java.lang.String strOwnerPw,
int iPermissionFlags)
strpath - the name of the PDF output file to be createdstrUserPw - the user password for encrypting the PDF document. If this
parameter is omitted, the default password is used. Use "" to
set no password.strOwnerPw - the owner password for encrypting the PDF document. If this
parameter is omitted, the default password is used. Use "" to
set no password.iPermissionFlags - Permissions to set for encrypted PDF files encoded as integer
number (see class
NativeLibrary.PERMISSION). By default no
encryption is used (-1).
true: The opened document could successfully be
saved to file. false: The output file cannot be
created, it is recommended to abort the processing of the file
and log the error code and error message.public boolean saveInMemory()
close() call it can be accessed using the method
getPdf().
true: The PDF data could be saved in memory.
false otherwise.public byte[] getPdf()
saveInMemory().
public boolean close()
true: The file could be closed successfully.
false otherwise.public int getErrorCode()
NativeLibrary.ERRORCODEpublic int getBitonalCompression()
getBitonalCompressions() instead.
NativeLibrary.COMPRESSIONpublic void setBitonalCompression(int iCompression)
setBitonalCompressions(int) instead.
iCompression - the compression type; for valid compression types, see
NativeLibrary.COMPRESSIONpublic int getBitonalCompressions()
NativeLibrary.COMPRESSIONATTEMPT.public void setBitonalCompressions(int iCompression)
eComprAttemptRaweComprAttemptFlateeComprAttemptLZWeComprAttemptGroup3eComprAttemptGroup4eComprAttemptSourceeComprAttemptJBIG2
iCompression - the compression types; for valid compression types, see
NativeLibrary.COMPRESSIONATTEMPT.public int getMonochromeCompression()
getContinuousCompressions() instead.
NativeLibrary.COMPRESSIONpublic void setMonochromeCompression(int iCompression)
setContinuousCompressions(int) instead.
iCompression - the compression type; for valid compression types, see
NativeLibrary.COMPRESSIONpublic int getColorCompression()
getContinuousCompressions() instead.
NativeLibrary.COMPRESSIONpublic void setColorCompression(int iCompression)
setContinuousCompressions(int) instead.
iCompression - the compression type; for valid values, see
NativeLibrary.COMPRESSIONpublic int getContinuousCompressions()
NativeLibrary.COMPRESSIONATTEMPT.public void setContinuousCompressions(int iCompression)
eComprAttemptRaweComprAttemptJPEGeComprAttemptFlateeComprAttemptJPEG2000eComprAttemptSourceeComprAttemptMRC
iCompression - the compression types; for valid values, see
NativeLibrary.COMPRESSIONATTEMPT.public int getIndexedCompressions()
NativeLibrary.COMPRESSION.public void setIndexedCompressions(int iCompression)
eComprAttemptRaweComprAttemptFlateeComprAttemptLZWeComprAttemptSource
iCompression - the compression types; for valid values, see
NativeLibrary.COMPRESSIONATTEMPT.public boolean getForceRecompression()
true if images shall always be re-compressed.public void setForceRecompression(boolean bForce)
bForce - true to always re-compress images.public boolean getForceCompressionTypes()
setContinuousCompressions(int),
setBitonalCompressions(int), or
setIndexedCompressions(int).
true if images shall always have one of the set
compression types.public void setForceCompressionTypes(boolean bForce)
setContinuousCompressions(int),
setBitonalCompressions(int), or
setIndexedCompressions(int). Use this option if you want to
allow only the given compression types for images in the output PDF.
bForce - true if images shall always have one of the set
compression types.public boolean getImageStratConserv()
setClipImages(boolean)), re-sampled (
setResolutionDPI(float), setThresholdDPI(float)), or if
it has undergone a color conversion (setColorConversion(int)),
or if setForceRecompression(boolean) is enabled. Otherwise the
original input image is taken as is.
true if conservative image processing strategy is
enabled.public void setImageStratConserv(boolean bForce)
setClipImages(boolean)), re-sampled (
setResolutionDPI(float), setThresholdDPI(float)), or if
it has undergone a color conversion ( setColorConversion(int)),
or if setForceRecompression(boolean) is enabled. Otherwise the
original input image is taken as is.
bForce - true to enable conservative image processing
strategy.public float getResolutionDPI()
setThresholdDPI(float)).
public void setResolutionDPI(float fResolutionDPI)
setThresholdDPI(float)). Pre-blended images,
images with a color key mask, mask, and soft mask images are not
re-sampled.
fResolutionDPI - the resolution in DPI to which the images shall be
down-sampled.public void setThresholdDPI(float fThresholdDPI)
fThresholdDPI - the new threshold value.public float getThresholdDPI()
public int getColorConversion()
NativeLibrary.COLORCONVERSION.
public void setColorConversion(int iColorConversion)
The image can be not converted (eConvNone), converted to RGB (eConvRGB), to CMYK or gray scale. Color key masked images are not color converted. Pre-blended images can be converted from RGB to grayscale, if the force conversion feature is set.
Color conversion is applied before re-sampling. Therefore converting to grayscale will make the grayscale DPI and threshold DPI the reference values for the originally colored images.
Color conversion is mostly used for specific application areas. E.g. in the printing industry the CMYK color space is used, since it represents the colors that printer devices commonly support. If colors are exclusively used for the monitor, the RGB color space should be used.
iColorConversion - the conversion mode; for valid values, see
NativeLibrary.COLORCONVERSION.public int getDitheringMode()
NativeLibrary.DITHERINGMODE.public void setDitheringMode(int iDithering)
Note: The only values supported are eDitherNone and eDitherFloydSteinberg.
Some bi-tonal images try to evoke the impression of different levels of gray by randomly setting pixels to black. If dithering is applied during down-sampling then the gray levels of such images are preserved better. If dithering is switched off then lines (e.g. text glyphs) are preserved better.
iDithering - the dithering mode; for valid values, see
NativeLibrary.DITHERINGMODE. Currently,
only eDitherNone and eDitherFloydSteinberg are available.public int getImageQuality()
public void setImageQuality(int iQuality)
iQuality - the new quality value (0..100)public int getCompressionQuality()
getImageQuality() instead.
public void setCompressionQuality(int iQuality)
setImageQuality(int) instead.
iQuality - the new quality valuepublic boolean getClipImages()
true if clipping images is enabled.public void setClipImages(boolean bClip)
When enabled, then invisible parts of images are clipped (cropped). While
this does not affect visual parts of images, it may have a minor visual
impact because clipped images are re-compressed. Pre-blended images are
not clipped. Enabling setClipImages will also enable
setOptimizeResources(boolean).
bClip - = true will enable image clipping.public boolean getRemoveImages()
true if removing is enabled.public void setRemoveImages(boolean bClip)
When enabled then images and stencil masks are substituted by empty form XObjects. Inline images are left untouched.
public boolean getReduceColorComplexity()
setReduceColorComplexity(boolean).
true if color complexity reduction is enabled.public void setReduceColorComplexity(boolean bClip)
Images with device color spaces (DeviceRGB, DeviceGray, or DeviceGray) and indexed images with a device color space as base color space are analyzed and if possible converted as follows:
bReduce - = true enables color complexity reduction.public int getMrcMaskCompression()
NativeLibrary.COMPRESSIONpublic void setMrcMaskCompression(int iCompression)
NativeLibrary.COMPRESSION for possible values.
iCompression - the compression type for MRC masks.public int getMrcLayerCompression()
NativeLibrary.COMPRESSION.public void setMrcLayerCompression(int iCompression)
NativeLibrary.COMPRESSION for possible values.
iCompression - the compression type for MRC foreground and background layers.public boolean getMrcRecognizePictures()
true if recognizing photographic areas is enabled.public void setMrcRecognizePictures(boolean bRecognize)
bRecognize - true to enable the recognition of photographic
areas.public int getMrcPictCompression()
NativeLibrary.COMPRESSIONpublic void setMrcPictCompression(int iCompression)
NativeLibrary.COMPRESSION for possible values.
iCompression - the compression type for MRC foreground pictures.public int getMrcLayerQuality()
public void setMrcLayerQuality(int iQuality)
iQuality - the new quality value (0..100)public float getMrcLayerResolutionDPI()
public void setMrcLayerResolutionDPI(float fResolutionDPI)
fResolutionDPI - the target resolution in DPIpublic boolean getExtractImages()
true if image extraction is turned on.public void setExtractImages(boolean bExtract)
bExtract - = true will enable image extractionpublic boolean getExtractFonts()
Depending on the font type, the extracted font has one of the following three formats: fnt‹objno›.ttf or fnt‹objno›.pfb or fnt‹objno›.cff, where ‹objno› is the number of the PDF object of the font.
true if fonts are to be extracted.public void setExtractFonts(boolean bExtract)
Depending on the font type, the extracted font has one of the following three formats: fnt‹objno›.ttf or fnt‹objno›.pfb or fnt‹objno›.cff, where ‹objno› is the number of the PDF object of the font.
bExtract - true to extract fonts.public boolean getRemoveReduntantObjects()
true, duplicate objects are removed in order to reduce
the file size.
true if redundant objects shall be removed.public void setRemoveRedundantObjects(boolean bRemove)
true, duplicate objects are removed in order to reduce
the file size.
bRemove - true if duplicate objects shall be removed to
reduce the file size.public boolean getLinearize()
setLinearize(boolean).
true if output shall be linearized.public void setLinearize(boolean bLinearize)
A linearized document has a slightly larger file size than a non-linearized file and provides the following main features:
bLinearize - true to linearize the output.public int getStrip()
public void setStrip(int iStripModes)
NativeLibrary.STRIPTYPE can be combined
with the bitwise or operator.
iStripModes - strip modes. Valid modes are defined in the
NativeLibrary.STRIPTYPE class and can be
combined by adding/or-ing.public boolean getFlattenSignatureFields()
setFlattenSignatureFields(boolean).
true if signature appearances are flattened.public void setFlattenSignatureFields(boolean bFlatten)
When the property bFlatten is set to true, then digital
signatures (parts 1) are still removed, but their visual appearances
(parts 2) are flattened. I.e. they are retained and drawn as non-editable
graphic onto the page.
Note that the resulting PDF can be misleading as it visually appears to be signed, but it has no digital signature and hence, a viewer application does not report any broken signature. In most cases, such a behavior is undesirable.
bFlatten - true to enable flattening of signature
appearances.
public boolean renameFont(java.lang.String strFontName1,
java.lang.String strFontName2)
strFontName1 - The font named to be replaced.strFontName2 - The new font name.
true on success.public boolean unembedFont(java.lang.String strFontName)
strFontName - The name of the font whose font program will be removed.
true on success.public boolean getConvertToCFF()
true if Type1 fonts shall be compressed.public void setConvertToCFF(boolean bConvertToCFF)
bConvertToCFF - true to compress fonts.public float getColorResolutionDPI()
getResolutionDPI()public void setColorResolutionDPI(float fResolutionDPI)
fResolutionDPI - the target resolution value in DPI to which color images will
be downsampled.setResolutionDPI(float)public void setColorThresholdDPI(float fThresholdDPI)
fThresholdDPI - the new threshold resolution value.setThresholdDPI(float)public float getColorThresholdDPI()
getThresholdDPI()public float getBitonalResolutionDPI()
getResolutionDPI()public void setBitonalResolutionDPI(float fResolutionDPI)
fResolutionDPI - the target resolution value in DPI to which bi-tonal images
will be downsampled.public void setBitonalThresholdDPI(float fThresholdDPI)
fThresholdDPI - the new threshold resolution value.public float getBitonalThresholdDPI()
getThresholdDPI()public float getMonochromeResolutionDPI()
getThresholdDPI()public void setMonochromeResolutionDPI(float fResolutionDPI)
fResolutionDPI - the target resolution value in DPI to which monochrome images
will be downsampled.setResolutionDPI(float)public void setMonochromeThresholdDPI(float fThresholdDPI)
fThresholdDPI - the new threshold resolution value.public float getMonochromeThresholdDPI()
public boolean listImages(java.lang.String strFileName)
The list contains the header line: "PageNumber, ObjectNumber, Width, Height, BitsPerComponent, ColorSpace, Resolution, Filter, ImageSize, CompressedSize, CompressionRatio, FileName".
The meanings of these columns are:
strFileName - the name of the output file that saves the list of images.
true: The image information was successfully
extracted and written to the output text file. false
otherwise.public boolean listFonts(java.lang.String strFileName)
The list contains the header line: "FontName, FontType, Encoding, IsCID, IsEmbedded, IsSubsetted, Filename".
The meanings of these columns are:
strFileName - the name of the output file that saves the list of fonts.
true: The font information was successfully
extracted and written to the output text file. false
otherwise.public boolean getSubsetFonts()
Subsetting refers to removing those glyphs in a font that are not actually used in any text contained in the PDF.
true if fonts shall be subset.public void setSubsetFonts(boolean bSubset)
Subsetting refers to removing those glyphs in a font that are not actually used in any text contained in the PDF.
bSubset - true to subset fonts.public boolean getMergeEmbeddedFonts()
true if embedded fonts shall be merged.public void setMergeEmbeddedFonts(boolean bSubset)
bSubset - true to merge embedded font programs.public boolean getRemoveStandardFonts()
setRemoveStandardFonts(boolean).
true to remove the standard fonts.public void setRemoveStandardFonts(boolean bRemove)
A PDF Viewer must be able to display these 14 PDF Standard Fonts correctly. Therefore enabling this property usually should not visually alter the PDF when it is displayed.
Un-embedding the font works based on the font's Unicode information. I.e. the un-embedded font's characters are mapped to those of the original font with the same Unicode. Therefore, only fonts with Unicode information will be un-embedded by the 3-Heights™ PDF Optimization API. However, if a font's Unicode information is not correct, un-embedding may lead to visual differences. Whether or not a font's Unicode information is correct can be verified by extracting text that uses the font. Suitable tools for this purpose are for instance the 3-Heights™ PDF Extract Tool or an interactive PDF viewer. If the extracted text is meaningful, the font's Unicode information is correct and unembedding of the font will not lead to visual differences.
bRemove - true to remove the standard fontspublic boolean getRemoveNonSymbolicFonts()
public void setRemoveNonSymbolicFonts(boolean bRemove)
public boolean getOptimizeResources()
true to optimize the resources of the output.public void setOptimizeResources(boolean bOptimize)
bOptimize - true to optimize the resources of the output.public int getPageCount()
null.
public boolean setVersion(java.lang.String strVersion)
There are three parameters that influence the version of the PDF output file:
ContinuousCompressions = eComprAttemptJPEG2000
SetVersion("1.4")
If the input PDF contains color images to which JPEG2000 compression is
applied, the output file will be version 1.5. Otherwise it will be
version 1.4.
true if version changed successfully.
public boolean setInfoEntry(java.lang.String sKey,
java.lang.String sValue)
sKey - Key such as Creator, Subject, Keywords etc. or custom
attributes.sValue - The entry's value.public void setProfile(int iProfile)
iProfile - Valid profiles are defined in
NativeLibrary.OPTIMIZATIONPROFILE
public static boolean linearizeFile(java.lang.String strInFileName,
java.lang.String strPassword,
java.lang.String strOutFileName,
java.lang.String strUserPw,
java.lang.String strOwnerPw,
int iPermissionFlags)
By default no encryption is used (-1). The permissions that can be
granted are listed at the enumeration
NativeLibrary.PERMISSION. To not encrypt the output
document, set PermissionFlags to ePermNoEncryption (-1), user and owner
password to "". In order to allow high quality printing, flags ePermPrint
and ePermDigitalPrint need to be set.
strInFileName - The input PDF file name, i.e. the name of document that is
read.strPassword - The user or owner password of the input file name. A password
must be provided if the input file is protected by a user
password, otherwise an empty string can be passed as argument.strOutFileName - The output PDF file name, i.e. the name of the linearized
document that is written.strUserPw - The user password of the output PDF file. If this parameter is
omitted, the default password is used. Use "" to set no
password.strOwnerPw - The owner password of the output PDF file. If this parameter
is omitted, the default password is used. Use "" to set no
password.iPermissionFlags - The permission flags if the document is encrypted and secured
by an owner password.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||