org.apache.fop.pdf
Class PDFXObject
java.lang.Object
|
+--org.apache.fop.pdf.PDFObject
|
+--org.apache.fop.pdf.AbstractPDFStream
|
+--org.apache.fop.pdf.PDFXObject
- Direct Known Subclasses:
- PDFFormXObject
- public class PDFXObject
- extends AbstractPDFStream
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.
Constructor Summary |
PDFXObject(int xnumber,
PDFImage img)
create an XObject with the given number and name and load the
image in the object |
Method Summary |
protected java.lang.String |
buildStreamDict(java.lang.String lengthEntry)
Constructs the dictionary for the stream. |
protected int |
getSizeHint()
Returns a value that hints at the size of the encoded stream. |
int |
getXNumber()
Get the xnumber for this pdf object. |
protected int |
output(java.io.OutputStream stream)
Output the image as PDF.
|
protected void |
outputRawStreamData(java.io.OutputStream out)
Sends the raw stream data to the target OutputStream. |
protected void |
prepareImplicitFilters()
Prepares implicit filters (such as the DCTFilter for JPEG images). |
protected void |
setupFilterList()
This sets up the default filters for XObjects. |
Methods inherited from class org.apache.fop.pdf.PDFObject |
encode, encodeString, encodeText, formatDateTime, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, hasObjectNumber, referencePDF, setDocument, setObjectNumber, toPDF, toPDFString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PDFXObject
public PDFXObject(int xnumber,
PDFImage img)
- 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
getXNumber
public int getXNumber()
- Get the xnumber for this pdf object.
- Returns:
- the PDF XObject number
output
protected int output(java.io.OutputStream stream)
throws java.io.IOException
- Output the image as PDF.
This sets up the image dictionary and adds the image data stream.
- Overrides:
output
in class AbstractPDFStream
- Parameters:
stream
- the output stream to write the data- Returns:
- the length of the data written
- Throws:
java.io.IOException
- if there is an error writing the data
buildStreamDict
protected java.lang.String buildStreamDict(java.lang.String lengthEntry)
- Description copied from class:
AbstractPDFStream
- Constructs the dictionary for the stream. Override this method if you
need additional entries.
- Overrides:
buildStreamDict
in class AbstractPDFStream
- See Also:
AbstractPDFStream.buildStreamDict(String)
outputRawStreamData
protected void outputRawStreamData(java.io.OutputStream out)
throws java.io.IOException
- Description copied from class:
AbstractPDFStream
- Sends the raw stream data to the target OutputStream.
- Overrides:
outputRawStreamData
in class AbstractPDFStream
- See Also:
PDFStream.outputRawStreamData(OutputStream)
getSizeHint
protected int getSizeHint()
throws java.io.IOException
- Description copied from class:
AbstractPDFStream
- 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:
getSizeHint
in class AbstractPDFStream
- See Also:
AbstractPDFStream.getSizeHint()
prepareImplicitFilters
protected void prepareImplicitFilters()
- Description copied from class:
AbstractPDFStream
- 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:
prepareImplicitFilters
in class AbstractPDFStream
- See Also:
AbstractPDFStream.prepareImplicitFilters()
setupFilterList
protected void setupFilterList()
- This sets up the default filters for XObjects. It uses the PDFImage
instance to determine what default filters to apply.
- Overrides:
setupFilterList
in class AbstractPDFStream
- See Also:
AbstractPDFStream.setupFilterList()
Copyright 1999-2006 The Apache Software Foundation. All Rights Reserved.