public class Flattener
extends java.lang.Object
Note: 'Flattener' is available as a separately licensable add-on to PDFNet core license or for use via Cloud API (http://www.pdftron.com/pdfnet/cloud).
Note: See 'pdftron.PDF.Optimizer' for alternate approach to optimize PDFs with focus on file size reduction.
Modifier and Type | Field and Description |
---|---|
static int |
e_default
Render text that are somewhat clipped or occluded.
|
static int |
e_fast
Feature reduce PDF while trying to preserve some
complex PDF features (such as vector figures, transparency, shadings,
blend modes, Type3 fonts etc.) for pages that are already fast to render.
|
static int |
e_keep_all
Only render text that are completely occluded, or used as a clipping path.
|
static int |
e_keep_most
Only render text that are seriously clipped or occluded.
|
static int |
e_simple
Feature reduce PDF to a simple two layer representation consisting
of a single background RGB image and a simple top text layer.
|
static int |
e_strict
Render text that are marginally clipped or occluded.
|
static int |
e_very_strict
Render (flatten) any text that is clipped or occluded.
|
Constructor and Description |
---|
Flattener()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Frees the native memory of the object.
|
void |
Process(PDFDoc doc,
int mode)
Process each page in the PDF, flattening content that matches the mode criteria.
|
void |
setDPI(int dpi)
The output resolution, from 1 to 1000, in Dots Per Inch (DPI) at which to
render elements which cannot be directly converted.
|
void |
setJPGQuality(int quality)
Specifies the compression quality to use when generating JPEG images.
|
void |
setMaximumImagePixels(int max_pixels)
Specifies the maximum image size in pixels.
|
void |
setPreferJPG(boolean jpg)
Specifies whether to leave images in existing compression, or as JPEG.
|
void |
SetThreshold(int threshold)
Used to control how precise or relaxed text flattening is.
|
public static final int e_very_strict
public static final int e_strict
public static final int e_default
public static final int e_keep_most
public static final int e_keep_all
public static final int e_simple
public static final int e_fast
public Flattener() throws PDFNetException
PDFNetException
public void setDPI(int dpi) throws PDFNetException
dpi
- the resolution in Dots Per InchPDFNetException
public void setMaximumImagePixels(int max_pixels) throws PDFNetException
max_pixels
- the maximum number of pixels an image can have.PDFNetException
public void setPreferJPG(boolean jpg) throws PDFNetException
jpg
- if true PDF will contain all JPEG images.PDFNetException
public void setJPGQuality(int quality) throws PDFNetException
quality
- the JPEG compression quality, from 0(highest compression) to 100(best quality).PDFNetException
public void SetThreshold(int threshold) throws PDFNetException
threshold
- the threshold setting to use.PDFNetException
public void Process(PDFDoc doc, int mode) throws PDFNetException
doc
- the document to flatten.mode
- indicates the criteria for which elements are flattened.PDFNetException
public void destroy()