Package org.apache.fop.pdf
Class PDFFilterList
java.lang.Object
org.apache.fop.pdf.PDFFilterList
This class represents a list of PDF filters to be applied when serializing
the output of a PDF object.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Key for the filter used for normal contentstatic final String
Key for the default filterstatic final String
Key for the filter used for fontsstatic final String
Key for the filter used for imagesstatic final String
Key for the filter used for JPEG imagesstatic final String
Key for the filter used for metadatastatic final String
Key for the filter used for precompressed contentstatic final String
Key for the filter used for TIFF images -
Constructor Summary
ConstructorDescriptionDefault constructor.PDFFilterList
(boolean ignoreASCIIFilters) Use this descriptor if you want to have ASCII filters (such as ASCIIHex and ASCII85) ignored, for example, when encryption is active. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDefaultFilters
(Map filters, String type) Adds the default filters to this stream.void
Add a filter for compression of the stream by name.void
Add a filter for compression of the stream.applyFilters
(OutputStream stream) Applies all registered filters as necessary.protected String
Apply the filters to the data in the order given and return the /Filter and /DecodeParms entries for the stream dictionary.void
ensureFilterInPlace
(PDFFilter pdfFilter) Checks the filter list for the filter and adds it in the correct place if necessary.boolean
Returns true if all filters are disabled.boolean
Indicates whether the filter list is already initialized.protected void
Apply the filters to the data in the order given and add the /Filter and /DecodeParms entries to the stream dictionary.void
setDisableAllFilters
(boolean value) Used to disable all filters.
-
Field Details
-
DEFAULT_FILTER
Key for the default filter- See Also:
-
CONTENT_FILTER
Key for the filter used for normal content- See Also:
-
PRECOMPRESSED_FILTER
Key for the filter used for precompressed content- See Also:
-
IMAGE_FILTER
Key for the filter used for images- See Also:
-
JPEG_FILTER
Key for the filter used for JPEG images- See Also:
-
TIFF_FILTER
Key for the filter used for TIFF images- See Also:
-
FONT_FILTER
Key for the filter used for fonts- See Also:
-
METADATA_FILTER
Key for the filter used for metadata- See Also:
-
-
Constructor Details
-
PDFFilterList
public PDFFilterList()Default constructor.The flag for ignoring ASCII filters defaults to false.
-
PDFFilterList
public PDFFilterList(boolean ignoreASCIIFilters) Use this descriptor if you want to have ASCII filters (such as ASCIIHex and ASCII85) ignored, for example, when encryption is active.- Parameters:
ignoreASCIIFilters
- true if ASCII filters should be ignored
-
-
Method Details
-
setDisableAllFilters
public void setDisableAllFilters(boolean value) Used to disable all filters.- Parameters:
value
- true if all filters shall be disabled
-
isDisableAllFilters
public boolean isDisableAllFilters()Returns true if all filters are disabled.- Returns:
- true if all filters are disabled
-
isInitialized
public boolean isInitialized()Indicates whether the filter list is already initialized.- Returns:
- true if more there are filters present
-
addFilter
Add a filter for compression of the stream. Filters are applied in the order they are added. This should always be a new instance of the particular filter of choice. The applied flag in the filter is marked true after it has been applied to the data.- Parameters:
filter
- filter to add
-
addFilter
Add a filter for compression of the stream by name.- Parameters:
filterType
- name of the filter to add
-
ensureFilterInPlace
Checks the filter list for the filter and adds it in the correct place if necessary.- Parameters:
pdfFilter
- the filter to check / add
-
addDefaultFilters
Adds the default filters to this stream.- Parameters:
filters
- Map of filterstype
- which filter list to modify
-
buildFilterDictEntries
Apply the filters to the data in the order given and return the /Filter and /DecodeParms entries for the stream dictionary. If the filters have already been applied to the data (either externally, or internally) then the dictionary entries are built and returned.- Returns:
- a String representing the filter list
-
putFilterDictEntries
Apply the filters to the data in the order given and add the /Filter and /DecodeParms entries to the stream dictionary. If the filters have already been applied to the data (either externally, or internally) then the dictionary entries added.- Parameters:
dict
- the PDFDictionary to set the entries on
-
applyFilters
Applies all registered filters as necessary. The method returns an OutputStream which will receive the filtered contents.- Parameters:
stream
- raw data output stream- Returns:
- OutputStream filtered output stream
- Throws:
IOException
- In case of an I/O problem
-