|
fop 0.94 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.pdf.PDFObject
public abstract class PDFObject
generic PDF object. A PDF Document is essentially a collection of these objects. A PDF Object has a number and a generation (although the generation will always be 0 in new documents).
Field Summary | |
---|---|
protected static java.text.SimpleDateFormat |
DATE_FORMAT
Formatting pattern for PDF date |
protected static org.apache.commons.logging.Log |
log
logger for all PDFObjects (and descendants) |
Constructor Summary | |
---|---|
PDFObject()
|
Method Summary | |
---|---|
static byte[] |
encode(java.lang.String text)
Converts text to a byte array for writing to a PDF file. |
protected byte[] |
encodeString(java.lang.String string)
Encodes a String (3.2.3 in PDF 1.4 specs) |
protected byte[] |
encodeText(java.lang.String text)
Encodes a Text String (3.8.1 in PDF 1.4 specs) |
protected java.lang.String |
formatDateTime(java.util.Date time)
Formats a date/time according to the PDF specification (D:YYYYMMDDHHmmSSOHH'mm'). |
protected void |
formatObject(java.lang.Object obj,
java.lang.StringBuffer sb)
Formats an object for serialization to PDF. |
PDFDocument |
getDocument()
Returns the parent PDFDocument if assigned. |
PDFDocument |
getDocumentSafely()
Returns the parent PDFDocument, but unlike getDocument()
it throws an informative Exception if the parent document is unavailable
instead of having a NullPointerException somewhere without a message. |
int |
getGeneration()
Returns the object's generation. |
java.lang.String |
getObjectID()
Returns the PDF representation of the Object ID. |
int |
getObjectNumber()
Returns the object's number. |
boolean |
hasObjectNumber()
Indicates whether this PDFObject has already been assigned an object number. |
PDFReference |
makeReference()
Creates and returns a reference to this object. |
protected int |
output(java.io.OutputStream stream)
Write the PDF represention of this object |
java.lang.String |
referencePDF()
Returns the PDF representation of a reference to this object. |
void |
setDocument(PDFDocument doc)
Sets the parent PDFDocument. |
void |
setObjectNumber(int objnum)
Sets the object number |
java.lang.String |
toInlinePDFString()
Returns a representation of this object for in-object placement, i.e. if the object has an object number its reference is returned. |
protected byte[] |
toPDF()
Encodes the object as a byte array for output to a PDF file. |
protected java.lang.String |
toPDFString()
This method returns a String representation of the PDF object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static org.apache.commons.logging.Log log
protected static final java.text.SimpleDateFormat DATE_FORMAT
Constructor Detail |
---|
public PDFObject()
Method Detail |
---|
public int getObjectNumber()
public boolean hasObjectNumber()
public void setObjectNumber(int objnum)
objnum
- the object numberpublic int getGeneration()
public final PDFDocument getDocument()
public final PDFDocument getDocumentSafely()
getDocument()
it throws an informative Exception if the parent document is unavailable
instead of having a NullPointerException somewhere without a message.
public void setDocument(PDFDocument doc)
doc
- the PDFDocument.public java.lang.String getObjectID()
public java.lang.String referencePDF()
public PDFReference makeReference()
protected int output(java.io.OutputStream stream) throws java.io.IOException
stream
- the stream to write the PDF to
java.io.IOException
- if there is an error writing to the streamprotected byte[] toPDF()
protected java.lang.String toPDFString()
public java.lang.String toInlinePDFString()
toInlinePDFString
in interface PDFWritable
public static final byte[] encode(java.lang.String text)
text
- text to convert/encode
protected byte[] encodeText(java.lang.String text)
text
- the text to encode
protected byte[] encodeString(java.lang.String string)
string
- the string to encode
protected void formatObject(java.lang.Object obj, java.lang.StringBuffer sb)
obj
- the objectsb
- the StringBuffer to write toprotected java.lang.String formatDateTime(java.util.Date time)
time
- date/time value to format
|
fop 0.94 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |