org.apache.fop.pdf

Class PDFXObject

Implemented Interfaces:
PDFWritable
Known Direct 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.

Field Summary

Fields inherited from class org.apache.fop.pdf.PDFObject

DATE_FORMAT, log

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 String
buildStreamDict(String lengthEntry)
protected int
getSizeHint()
int
getXNumber()
Get the xnumber for this pdf object.
protected int
output(OutputStream stream)
Output the image as PDF.
protected void
outputRawStreamData(OutputStream out)
protected void
prepareImplicitFilters()
protected void
setupFilterList()
This sets up the default filters for XObjects.

Methods inherited from class org.apache.fop.pdf.AbstractPDFStream

buildStreamDict, encodeAndWriteStream, encodeStream, getFilterList, getSizeHint, output, outputRawStreamData, outputStreamData, prepareImplicitFilters, setupFilterList

Methods inherited from class org.apache.fop.pdf.PDFObject

encode, encodeString, encodeText, formatDateTime, formatObject, getDocument, getDocumentSafely, getGeneration, getObjectID, getObjectNumber, hasObjectNumber, makeReference, output, referencePDF, setDocument, setObjectNumber, toInlinePDFString, toPDF, toPDFString

Constructor Details

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 number
img - the pdf image that contains the image data

Method Details

buildStreamDict

protected String buildStreamDict(String lengthEntry)
Overrides:
buildStreamDict in interface AbstractPDFStream

getSizeHint

protected int getSizeHint()
            throws IOException
Overrides:
getSizeHint in interface AbstractPDFStream

getXNumber

public int getXNumber()
Get the xnumber for this pdf object.
Returns:
the PDF XObject number

output

protected int output(OutputStream stream)
            throws IOException
Output the image as PDF. This sets up the image dictionary and adds the image data stream.
Overrides:
output in interface AbstractPDFStream
Parameters:
stream - the output stream to write the data
Returns:
the length of the data written

outputRawStreamData

protected void outputRawStreamData(OutputStream out)
            throws IOException
Overrides:
outputRawStreamData in interface AbstractPDFStream

prepareImplicitFilters

protected void prepareImplicitFilters()
Overrides:
prepareImplicitFilters in interface AbstractPDFStream

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 interface AbstractPDFStream

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.