Package org.apache.fop.pdf
Class PDFImageXObject
java.lang.Object
org.apache.fop.pdf.PDFObject
org.apache.fop.pdf.AbstractPDFStream
org.apache.fop.pdf.PDFXObject
org.apache.fop.pdf.PDFImageXObject
- All Implemented Interfaces:
PDFWritable
PDF XObject
A derivative of the PDF Object, is a PDF Stream that has not only a
dictionary but a stream of image data.
The dictionary just provides information like the stream length.
This outputs the image dictionary and the image data.
This is used as a reference for inserting the same image in the
document in another place.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionPDFImageXObject(int xnumber, PDFImage img) create an XObject with the given number and name and load the image in the object -
Method Summary
Modifier and TypeMethodDescriptionvoidgetChildren(Set<PDFObject> children) protected StringReturns the name of a suitable filter for this PDF object.protected intReturns a value that hints at the size of the encoded stream.protected booleanWhether multiple filters can be applied.intoutput(OutputStream stream) Output the image as PDF.protected voidSends the raw stream data to the target OutputStream.protected voidpopulateStreamDict(Object lengthEntry) Populates the dictionary with all necessary entries for the stream.protected voidPrepares implicit filters (such as the DCTFilter for JPEG images).Methods inherited from class org.apache.fop.pdf.PDFXObject
getNameMethods inherited from class org.apache.fop.pdf.AbstractPDFStream
encodeAndWriteStream, encodeStream, get, getDictionary, getFilterList, outputStreamData, put, registerChildren, setDocument, setupFilterListMethods inherited from class org.apache.fop.pdf.PDFObject
contentEquals, encode, encodeBinaryToHexString, encodeString, encodeText, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, getParent, hasObjectNumber, makeReference, outputInline, referencePDF, setObjectNumber, setObjectNumber, setObjectNumber, setParent, toPDF, toPDFString
-
Constructor Details
-
PDFImageXObject
create an XObject with the given number and name and load the image in the object- Parameters:
xnumber- the pdf object X numberimg- the pdf image that contains the image data
-
-
Method Details
-
output
Output the image as PDF. This sets up the image dictionary and adds the image data stream.- Overrides:
outputin classAbstractPDFStream- Parameters:
stream- the output stream to write the data- Returns:
- the length of the data written
- Throws:
IOException- if there is an error writing the data
-
populateStreamDict
Populates the dictionary with all necessary entries for the stream. Override this method if you need additional entries.- Overrides:
populateStreamDictin classPDFXObject- Parameters:
lengthEntry- value for the /Length entry
-
outputRawStreamData
Sends the raw stream data to the target OutputStream.- Specified by:
outputRawStreamDatain classAbstractPDFStream- Parameters:
out- OutputStream to write to- Throws:
IOException- In case of an I/O problem
-
getSizeHint
Returns a value that hints at the size of the encoded stream. This is used to optimize buffer allocation so fewer buffer reallocations are necessary.- Overrides:
getSizeHintin classPDFXObject- Returns:
- an estimated size (0 if no hint can be given)
- Throws:
IOException- in case of an I/O problem
-
prepareImplicitFilters
protected void prepareImplicitFilters()Prepares implicit filters (such as the DCTFilter for JPEG images). You must make sure that the appropriate filters are in the filter list at the right places.- Overrides:
prepareImplicitFiltersin classAbstractPDFStream
-
getDefaultFilterName
Returns the name of a suitable filter for this PDF object. This class uses the PDFImage instance to determine the default filter.- Overrides:
getDefaultFilterNamein classAbstractPDFStream- Returns:
- the default filter
- See Also:
-
multipleFiltersAllowed
protected boolean multipleFiltersAllowed()Whether multiple filters can be applied.- Overrides:
multipleFiltersAllowedin classAbstractPDFStream- Returns:
- true if multiple filters allowed
-
getChildren
- Overrides:
getChildrenin classAbstractPDFStream
-