|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.foray.pdf.object.PDFDocument
public class PDFDocument
Represents a PDF document. The document is built up by calling various methods and then finally output to given filehandle using output method. A PDF document consists of a series of numbered objects preceded by a header and followed by an xref table and trailer. The xref table allows for quick access to objects by listing their character positions within the document. For this reason the PDF document must keep track of the character position of each object. The document also keeps direct track of the /Root, /Info and /Resources objects.
Field Summary | |
---|---|
static int |
DEFAULT_CHARACTERS_PER_LINE
The default line length of the output PDF document. |
static String |
ENCODING
Name of the CharSet that should be used when converting Strings to bytes. |
Constructor Summary | |
---|---|
PDFDocument(OutputStream outputStream,
org.apache.commons.logging.Log logger,
org.axsl.ps.PsServer psServer)
Constructor which creates an empty PDF document. |
Method Summary | |
---|---|
void |
addDefaultFilter(String filterToAdd)
|
void |
addNamedDestination(String name,
PDFDestination destination)
Add a named destination to this document. |
void |
addPageLabelRange(int startingPageIndex,
org.axsl.pdf.PdfPageLabelStyle labelStyle,
CharSequence labelPrefix,
int startingPageNumber)
|
void |
close()
|
PDFPattern |
createGradient(org.axsl.common.Gradient gradient)
|
PDFColor |
createPdfColor(Color color)
|
PDFEncryption |
createPdfEncryption()
|
PDFPage |
createPdfPage(int pagewidth,
int pageheight)
|
PDFXObject |
findXObject(org.axsl.graphic.Graphic graphic)
If a PDFXObject has already been created for a given URL, return that PDFXObject so that it can be reused. |
int |
getCharsPerLine()
Return the number of characters per line that should be written into the PDF. |
ColorSpace |
getColorSpace()
Returns the color space for this document. |
PDFBorderStyle |
getDefaultBorderStyle()
Returns the default border style for this document. |
List<String> |
getDefaultFilters()
Return the default list of filters to be applied to streams in this document. |
PDFEncryption |
getEncryption()
Returns the encryption for this document, if any. |
String |
getFontName(org.axsl.font.FontUse fontUse)
|
String |
getGradientName(org.axsl.common.Gradient gradient)
|
PDFInfo |
getInfo()
Get the /Info object for the document. |
org.apache.commons.logging.Log |
getLogger()
Return the logger. |
String |
getNextFontSubsetTag()
Computes the next available tag to be used as a prefix for a BaseFont or FontName entry, when the font is subsetted. |
PDFOutlineParent |
getOutlineRoot()
|
PDFFont |
getPdfFont(org.axsl.font.output.FontPdf fontUse)
Obtain a PDFFont for a given FontUse instance. |
org.axsl.ps.PsServer |
getPsServer()
Returns the PostScript server. |
PDFResources |
getResources()
Returns the /Resources object for the document. |
PDFRoot |
getRoot()
Return the root object. |
PDFEncoding |
obtainPDFEncoding(org.axsl.ps.Encoding encoding)
Obtain a PDFEncoding for a given Encoding instance. |
int |
registerFontResource(PDFFont font)
Register a font resource for use in this document. |
void |
registerIndirectObject(PDFObject object)
Register an object as an indirect object. |
void |
registerIndirectObjectLast(PDFObject object)
Register an object as an indirect object that should be written at the end of the PDF output. |
int |
registerPatternResource(PDFPattern pattern)
Register a pattern resource for use in this document. |
int |
registerShadingResource(PDFShading shading)
Register a shading resource for use in this document. |
int |
registerXObjectResource(org.axsl.graphic.Graphic graphic,
PDFXObject theXObject)
Register an X object for use in this document. |
void |
setAuthor(String author)
Sets the author of the document. |
void |
setColorSpace(ColorSpace theColorspace)
Sets the color space for this document. |
void |
setCreationDate(Date creationDate)
|
void |
setKeywords(String keywords)
Sets the keywords of the document. |
void |
setProducer(String producer)
|
void |
setSubject(String subject)
Sets the subject of the document. |
void |
setTitle(String title)
Sets the title of the document. |
void |
setVersion(org.axsl.pdf.PdfVersion newVersion)
If not set, the default value is PDF_VERSION_1_6. |
void |
writeHeader()
|
void |
writeIndirectObjects()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ENCODING
public static final int DEFAULT_CHARACTERS_PER_LINE
Constructor Detail |
---|
public PDFDocument(OutputStream outputStream, org.apache.commons.logging.Log logger, org.axsl.ps.PsServer psServer)
outputStream
- The output stream to which this document should be
written.logger
- The logger to which user messages should be written.psServer
- The PostScript server.Method Detail |
---|
public void setVersion(org.axsl.pdf.PdfVersion newVersion)
setVersion
in interface org.axsl.pdf.PdfDocument
public PDFEncryption getEncryption()
public ColorSpace getColorSpace()
public void setColorSpace(ColorSpace theColorspace)
theColorspace
- The new color space.public PDFOutlineParent getOutlineRoot()
getOutlineRoot
in interface org.axsl.pdf.PdfDocument
public PDFResources getResources()
public PDFInfo getInfo()
public void writeIndirectObjects() throws org.axsl.pdf.PdfException
writeIndirectObjects
in interface org.axsl.pdf.PdfDocument
org.axsl.pdf.PdfException
public void writeHeader() throws org.axsl.pdf.PdfException
writeHeader
in interface org.axsl.pdf.PdfDocument
org.axsl.pdf.PdfException
public void close() throws org.axsl.pdf.PdfException
close
in interface org.axsl.pdf.PdfDocument
org.axsl.pdf.PdfException
public void registerIndirectObject(PDFObject object)
object
- The object to be registered as an indirect object.public void registerIndirectObjectLast(PDFObject object)
object
- The object to be registered.public int registerShadingResource(PDFShading shading)
shading
- The shading resource to register.
public int registerPatternResource(PDFPattern pattern)
pattern
- The pattern resource to register.
public int registerFontResource(PDFFont font)
font
- The font resource to register.
public int registerXObjectResource(org.axsl.graphic.Graphic graphic, PDFXObject theXObject)
graphic
- The Graphic instance backing the X object resource.theXObject
- The X object to register.
public PDFRoot getRoot()
public List<String> getDefaultFilters()
public void addDefaultFilter(String filterToAdd)
addDefaultFilter
in interface org.axsl.pdf.PdfDocument
public String getNextFontSubsetTag()
public org.apache.commons.logging.Log getLogger()
public PDFBorderStyle getDefaultBorderStyle()
public PDFXObject findXObject(org.axsl.graphic.Graphic graphic)
graphic
- The Graphic instance for which a PDFXObject is sought.
public PDFEncoding obtainPDFEncoding(org.axsl.ps.Encoding encoding)
encoding
- The encoding for which a PDFEncoding is needed.
public PDFFont getPdfFont(org.axsl.font.output.FontPdf fontUse)
getPdfFont
in interface org.axsl.pdf.PdfDocument
fontUse
- The font for which a PDFFont is needed.
public void setTitle(String title)
setTitle
in interface org.axsl.pdf.PdfDocument
title
- The new title for the document.public void setAuthor(String author)
setAuthor
in interface org.axsl.pdf.PdfDocument
author
- The new author of the document.public void setSubject(String subject)
setSubject
in interface org.axsl.pdf.PdfDocument
subject
- The new subject of the document.public void setKeywords(String keywords)
setKeywords
in interface org.axsl.pdf.PdfDocument
keywords
- The new keywords of the document.public void setProducer(String producer)
setProducer
in interface org.axsl.pdf.PdfDocument
public void setCreationDate(Date creationDate)
setCreationDate
in interface org.axsl.pdf.PdfDocument
public void addNamedDestination(String name, PDFDestination destination) throws org.axsl.pdf.PdfException
name
- The name to which destination
should be mapped.destination
- The destination to be mapped to name
.
org.axsl.pdf.PdfException
- If name
has already been registered
in this document.public PDFEncryption createPdfEncryption()
createPdfEncryption
in interface org.axsl.pdf.PdfDocument
public PDFColor createPdfColor(Color color)
createPdfColor
in interface org.axsl.pdf.PdfDocument
public PDFPage createPdfPage(int pagewidth, int pageheight)
createPdfPage
in interface org.axsl.pdf.PdfDocument
public int getCharsPerLine()
public String getFontName(org.axsl.font.FontUse fontUse)
getFontName
in interface org.axsl.graphic.output.GraphicOutputContext
public String getGradientName(org.axsl.common.Gradient gradient)
getGradientName
in interface org.axsl.graphic.output.GraphicOutputContext
public void addPageLabelRange(int startingPageIndex, org.axsl.pdf.PdfPageLabelStyle labelStyle, CharSequence labelPrefix, int startingPageNumber)
addPageLabelRange
in interface org.axsl.pdf.PdfDocument
public PDFPattern createGradient(org.axsl.common.Gradient gradient)
createGradient
in interface org.axsl.pdf.PdfDocument
public org.axsl.ps.PsServer getPsServer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |