|
fop 2.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fop.pdf.PDFFactory
public class PDFFactory
This class provides method to create and register PDF objects.
Field Summary | |
---|---|
static int |
DEFAULT_PDF_RESOLUTION
Resolution of the User Space coordinate system (72dpi). |
Constructor Summary | |
---|---|
PDFFactory(PDFDocument document)
Creates a new PDFFactory. |
Method Summary | |
---|---|
java.lang.Object |
createPDFEncoding(SingleByteEncoding encoding,
java.lang.String fontName)
Creates a PDFEncoding instance from a CodePointMapping instance. |
PDFDocument |
getDocument()
Returns the parent PDFDocument associated with this factory. |
PDFAction |
getExternalAction(java.lang.String target,
boolean newWindow)
Create/find and return the appropriate external PDFAction according to the target |
java.lang.String |
getGoToReference(java.lang.String pdfPageRef,
float yoffset)
Create or find a PDF GoTo with the given page reference string and Y offset, and return its PDF object reference |
PDFGoTo |
getPDFGoTo(java.lang.String pdfPageRef,
java.awt.geom.Point2D position)
Finds and returns a PDFGoTo to the given page and position. |
protected PDFDestination |
getUniqueDestination(PDFDestination newdest)
Registers and returns newdest if it is unique. |
PDFAnnotList |
makeAnnotList()
Make an annotation list object |
PDFArray |
makeArray(int[] values)
Make an Array object (ex. |
PDFDestination |
makeDestination(java.lang.String idRef,
java.lang.Object goToRef)
Make a named destination. |
PDFDests |
makeDests(java.util.List destinationList)
Make a the head object of the name dictionary (the /Dests object). |
void |
makeDPart(PDFPage page,
java.lang.String pageMasterName)
|
PDFDPartRoot |
makeDPartRoot()
|
PDFEncoding |
makeEncoding(java.lang.String encodingName)
make a /Encoding object |
PDFFont |
makeFont(java.lang.String fontname,
java.lang.String basefont,
java.lang.String encoding,
FontMetrics metrics,
FontDescriptor descriptor)
Make a Type1 /Font object. |
AbstractPDFStream |
makeFontFile(FontDescriptor desc,
java.lang.String fontPrefix)
Embeds a font. |
PDFFunction |
makeFunction(java.util.List domain,
java.util.List range,
float[] cZero,
float[] cOne,
double interpolationExponentN)
make a type Exponential interpolation function (for shading usually) |
PDFGState |
makeGState(java.util.Map settings,
PDFGState current)
make an ExtGState for extra graphics options This tries to find a GState that will setup the correct values for the current context. |
PDFICCBasedColorSpace |
makeICCBasedColorSpace(PDFResourceContext res,
java.lang.String explicitName,
PDFICCStream iccStream)
Makes a new ICCBased color space and registers it in the resource context. |
protected PDFInfo |
makeInfo(java.lang.String prod)
make an /Info object |
PDFLayer |
makeLayer(java.lang.String id)
|
PDFLink |
makeLink(java.awt.geom.Rectangle2D rect,
PDFAction pdfAction)
Create a PDF link to an existing PDFAction object |
PDFLink |
makeLink(java.awt.geom.Rectangle2D rect,
java.lang.String destination,
int linkType,
float yoffset)
Make a PDFLink object |
PDFLink |
makeLink(java.awt.geom.Rectangle2D rect,
java.lang.String page,
java.lang.String dest)
Make an internal link. |
PDFMetadata |
makeMetadata(org.apache.xmlgraphics.xmp.Metadata meta,
boolean readOnly)
Make a Metadata object. |
PDFNames |
makeNames()
Make a names dictionary (the /Names object). |
PDFNameTreeNode |
makeNameTreeNode()
Make a name tree node. |
PDFNavigator |
makeNavigator(java.lang.String id)
|
PDFOutline |
makeOutline(PDFOutline parent,
java.lang.String label,
PDFAction pdfAction,
boolean showSubItems)
Make an outline object and add it to the given parent |
PDFOutline |
makeOutline(PDFOutline parent,
java.lang.String label,
PDFReference actionRef,
boolean showSubItems)
Make an outline object and add it to the given parent |
PDFOutline |
makeOutline(PDFOutline parent,
java.lang.String label,
java.lang.String destination,
float yoffset,
boolean showSubItems)
Make an outline object and add it to the given outline |
PDFOutputIntent |
makeOutputIntent()
Make a OutputIntent dictionary. |
PDFPage |
makePage(PDFResources resources,
int pageWidth,
int pageHeight)
Make a /Page object. |
PDFPage |
makePage(PDFResources resources,
int pageWidth,
int pageHeight,
int pageIndex)
Make a /Page object. |
PDFPage |
makePage(PDFResources resources,
int pageIndex,
java.awt.geom.Rectangle2D mediaBox,
java.awt.geom.Rectangle2D cropBox,
java.awt.geom.Rectangle2D bleedBox,
java.awt.geom.Rectangle2D trimBox)
Make a /Page object. |
PDFPageLabels |
makePageLabels()
Make a names dictionary (the /PageLabels object). |
PDFPages |
makePages()
Make a /Pages object. |
PDFPattern |
makePattern(PDFResourceContext res,
int thePatternType,
PDFResources theResources,
int thePaintType,
int theTilingType,
java.util.List theBBox,
double theXStep,
double theYStep,
java.util.List theMatrix,
java.util.List theXUID,
java.lang.StringBuffer thePatternDataStream)
Make a tiling pattern |
PDFICCStream |
makePDFICCStream()
Create a PDFICCStream |
PDFResources |
makeResources()
Make a /Resources object. |
PDFRoot |
makeRoot(PDFPages pages)
Make a /Catalog (Root) object. |
PDFSeparationColorSpace |
makeSeparationColorSpace(PDFResourceContext res,
org.apache.xmlgraphics.java2d.color.NamedColorSpace ncs)
Create a new Separation color space. |
PDFSetOCGStateAction |
makeSetOCGStateAction(java.lang.String id)
|
PDFStream |
makeStream(java.lang.String type,
boolean add)
Make a stream object |
PDFTransitionAction |
makeTransitionAction(java.lang.String id)
|
PDFFunction |
registerFunction(PDFFunction function)
Registers a function against the document |
PDFPattern |
registerPattern(PDFResourceContext res,
PDFPattern pattern)
|
PDFShading |
registerShading(PDFResourceContext res,
PDFShading shading)
Registers a shading object against the document |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_PDF_RESOLUTION
Constructor Detail |
---|
public PDFFactory(PDFDocument document)
document
- the parent PDFDocument needed to register the generated
objectsMethod Detail |
---|
public final PDFDocument getDocument()
public PDFRoot makeRoot(PDFPages pages)
pages
- the pages pdf object that the root points to
public PDFPages makePages()
public PDFResources makeResources()
protected PDFInfo makeInfo(java.lang.String prod)
prod
- string indicating application producing the PDF
public PDFMetadata makeMetadata(org.apache.xmlgraphics.xmp.Metadata meta, boolean readOnly)
meta
- the DOM Document containing the XMP metadata.readOnly
- true if the metadata packet should be marked read-only
public PDFOutputIntent makeOutputIntent()
public PDFPage makePage(PDFResources resources, int pageIndex, java.awt.geom.Rectangle2D mediaBox, java.awt.geom.Rectangle2D cropBox, java.awt.geom.Rectangle2D bleedBox, java.awt.geom.Rectangle2D trimBox)
resources
- resources object to usepageIndex
- index of the page (zero-based)mediaBox
- the MediaBox areacropBox
- the CropBox areableedBox
- the BleedBox areatrimBox
- the TrimBox area
public PDFPage makePage(PDFResources resources, int pageWidth, int pageHeight, int pageIndex)
resources
- resources object to usepageWidth
- width of the page in pointspageHeight
- height of the page in pointspageIndex
- index of the page (zero-based)
public PDFPage makePage(PDFResources resources, int pageWidth, int pageHeight)
resources
- resources object to usepageWidth
- width of the page in pointspageHeight
- height of the page in points
public PDFFunction makeFunction(java.util.List domain, java.util.List range, float[] cZero, float[] cOne, double interpolationExponentN)
domain
- List objects of Double objects.
This is the domain of the function.
See page 264 of the PDF 1.3 Spec.range
- List of Doubles that is the Range of the function.
See page 264 of the PDF 1.3 Spec.cZero
- This is a vector of Double objects which defines the function result
when x=0.
This attribute is optional.
It's described on page 268 of the PDF 1.3 spec.cOne
- This is a vector of Double objects which defines the function result
when x=1.
This attribute is optional.
It's described on page 268 of the PDF 1.3 spec.interpolationExponentN
- This is the inerpolation exponent.
This attribute is required.
PDF Spec page 268
public PDFFunction registerFunction(PDFFunction function)
function
- The function to registerpublic PDFShading registerShading(PDFResourceContext res, PDFShading shading)
res
- The PDF resource contextshading
- The shading object to be registeredpublic PDFPattern makePattern(PDFResourceContext res, int thePatternType, PDFResources theResources, int thePaintType, int theTilingType, java.util.List theBBox, double theXStep, double theYStep, java.util.List theMatrix, java.util.List theXUID, java.lang.StringBuffer thePatternDataStream)
res
- the PDF resource context to add the shading, may be nullthePatternType
- the type of pattern, which is 1 for tiling.theResources
- the resources associated with this patternthePaintType
- 1 or 2, colored or uncolored.theTilingType
- 1, 2, or 3, constant spacing, no distortion, or faster tilingtheBBox
- List of Doubles: The pattern cell bounding boxtheXStep
- horizontal spacingtheYStep
- vertical spacingtheMatrix
- Optional List of Doubles transformation matrixtheXUID
- Optional vector of Integers that uniquely identify the patternthePatternDataStream
- The stream of pattern data to be tiled.
public PDFPattern registerPattern(PDFResourceContext res, PDFPattern pattern)
protected PDFDestination getUniqueDestination(PDFDestination newdest)
newdest
- a new, as yet unregistered destination
public PDFDestination makeDestination(java.lang.String idRef, java.lang.Object goToRef)
idRef
- ID Reference for this destination (the name of the destination)goToRef
- Object reference to the GoTo Action
public PDFNames makeNames()
public PDFPageLabels makePageLabels()
public PDFDests makeDests(java.util.List destinationList)
destinationList
- a list of PDFDestination instances
public PDFNameTreeNode makeNameTreeNode()
public PDFLink makeLink(java.awt.geom.Rectangle2D rect, PDFAction pdfAction)
rect
- the hotspot position in absolute coordinatespdfAction
- the PDFAction that this link refers to
public PDFLink makeLink(java.awt.geom.Rectangle2D rect, java.lang.String page, java.lang.String dest)
rect
- the hotspot position in absolute coordinatespage
- the target page reference valuedest
- the position destination
public PDFLink makeLink(java.awt.geom.Rectangle2D rect, java.lang.String destination, int linkType, float yoffset)
PDFLink
object
rect
- the clickable rectangledestination
- the destination filelinkType
- the link typeyoffset
- the yoffset on the page for an internal link
public PDFAction getExternalAction(java.lang.String target, boolean newWindow)
target
- The external target. This may be a PDF file name
(optionally with internal page number or destination) or any type of URI.newWindow
- boolean indicating whether the target should be
displayed in a new window
public java.lang.String getGoToReference(java.lang.String pdfPageRef, float yoffset)
pdfPageRef
- the PDF page reference, e.g. "23 0 R"yoffset
- the distance from the bottom of the page in points
public PDFGoTo getPDFGoTo(java.lang.String pdfPageRef, java.awt.geom.Point2D position)
pdfPageRef
- the PDF page referenceposition
- the (X,Y) position in points
public PDFOutline makeOutline(PDFOutline parent, java.lang.String label, PDFReference actionRef, boolean showSubItems)
parent
- the parent PDFOutline object (may be null)label
- the title for the new outline objectactionRef
- the action reference string to be placed after the /AshowSubItems
- whether to initially display child outline items
public PDFOutline makeOutline(PDFOutline parent, java.lang.String label, PDFAction pdfAction, boolean showSubItems)
parent
- the parent PDFOutline object (may be null)label
- the title for the new outline objectpdfAction
- the action that this outline item points to - must not be null!showSubItems
- whether to initially display child outline items
public PDFOutline makeOutline(PDFOutline parent, java.lang.String label, java.lang.String destination, float yoffset, boolean showSubItems)
parent
- parent PDFOutline object which may be nulllabel
- the title for the new outline objectdestination
- the reference string for the action to go toyoffset
- the yoffset on the destination pageshowSubItems
- whether to initially display child outline items
public PDFEncoding makeEncoding(java.lang.String encodingName)
encodingName
- character encoding scheme name
public PDFFont makeFont(java.lang.String fontname, java.lang.String basefont, java.lang.String encoding, FontMetrics metrics, FontDescriptor descriptor)
fontname
- internal name to use for this font (eg "F1")basefont
- name of the base font (eg "Helvetica")encoding
- character encoding scheme used by the fontmetrics
- additional information about the fontdescriptor
- additional information about the font
public java.lang.Object createPDFEncoding(SingleByteEncoding encoding, java.lang.String fontName)
encoding
- the code point mapping (encoding)fontName
- ...
public AbstractPDFStream makeFontFile(FontDescriptor desc, java.lang.String fontPrefix)
desc
- FontDescriptor of the font.
public PDFStream makeStream(java.lang.String type, boolean add)
type
- the type of stream to be createdadd
- if true then the stream will be added immediately
public PDFICCStream makePDFICCStream()
PDFImageXObject
,
PDFDeviceColorSpace
public PDFICCBasedColorSpace makeICCBasedColorSpace(PDFResourceContext res, java.lang.String explicitName, PDFICCStream iccStream)
res
- the PDF resource context to add the shading, may be nullexplicitName
- the explicit name for the color space, may be nulliccStream
- the ICC stream to associate with this color space
public PDFSeparationColorSpace makeSeparationColorSpace(PDFResourceContext res, org.apache.xmlgraphics.java2d.color.NamedColorSpace ncs)
res
- the resource context (may be null)ncs
- the named color space to map to a separation color space
public PDFArray makeArray(int[] values)
values
- the int array values
public PDFGState makeGState(java.util.Map settings, PDFGState current)
settings
- the settings required by the callercurrent
- the current GState of the current PDF context
public PDFAnnotList makeAnnotList()
public PDFLayer makeLayer(java.lang.String id)
public PDFSetOCGStateAction makeSetOCGStateAction(java.lang.String id)
public PDFTransitionAction makeTransitionAction(java.lang.String id)
public PDFNavigator makeNavigator(java.lang.String id)
public void makeDPart(PDFPage page, java.lang.String pageMasterName)
public PDFDPartRoot makeDPartRoot()
|
fop 2.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |