|
fop 0.95 | |||||||||
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.
Constructor Summary | |
---|---|
PDFFactory(PDFDocument document)
Creates a new PDFFactory. |
Method Summary | |
---|---|
PDFDocument |
getDocument()
Returns the parent PDFDocument associated with this factory. |
PDFAction |
getExternalAction(java.lang.String target)
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. |
PDFWArray |
getSubsetWidths(CIDFont cidFont)
|
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). |
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 |
PDFFontDescriptor |
makeFontDescriptor(FontDescriptor desc)
make a /FontDescriptor object |
AbstractPDFStream |
makeFontFile(FontDescriptor desc)
Embeds a font. |
PDFFunction |
makeFunction(int theNumber,
int theFunctionType,
java.util.List theDomain,
java.util.List theRange,
java.lang.StringBuffer theFunctionDataStream)
make a postscript calculator function |
PDFFunction |
makeFunction(int theFunctionType,
java.util.List theDomain,
java.util.List theRange,
java.util.List theSize,
int theBitsPerSample,
int theOrder,
java.util.List theEncode,
java.util.List theDecode,
java.lang.StringBuffer theFunctionDataStream,
java.util.List theFilter)
Make a Type 0 sampled function |
PDFFunction |
makeFunction(int theFunctionType,
java.util.List theDomain,
java.util.List theRange,
java.util.List theCZero,
java.util.List theCOne,
double theInterpolationExponentN)
make a type Exponential interpolation function (for shading usually) |
PDFFunction |
makeFunction(int theFunctionType,
java.util.List theDomain,
java.util.List theRange,
java.util.List theFunctions,
java.util.List theBounds,
java.util.List theEncode)
Make a Type 3 Stitching function |
PDFPattern |
makeGradient(PDFResourceContext res,
boolean radial,
PDFDeviceColorSpace theColorspace,
java.util.List theColors,
java.util.List theBounds,
java.util.List theCoords,
java.util.List theMatrix)
Make a gradient |
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 |
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 link 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. |
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,
java.lang.String 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. |
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 |
PDFPattern |
makePattern(PDFResourceContext res,
int thePatternType,
PDFShading theShading,
java.util.List theXUID,
java.lang.StringBuffer theExtGState,
java.util.List theMatrix)
Make a smooth shading pattern |
PDFICCStream |
makePDFICCStream()
Create a PDFICCStream |
PDFResources |
makeResources()
Make a /Resources object. |
PDFRoot |
makeRoot(PDFPages pages)
Make a /Catalog (Root) object. |
PDFShading |
makeShading(PDFResourceContext res,
int theShadingType,
PDFDeviceColorSpace theColorSpace,
java.util.List theBackground,
java.util.List theBBox,
boolean theAntiAlias,
int theBitsPerCoordinate,
int theBitsPerComponent,
int theBitsPerFlag,
java.util.List theDecode,
PDFFunction theFunction)
Make a free-form gouraud shaded triangle mesh, coons patch mesh, or tensor patch mesh shading object |
PDFShading |
makeShading(PDFResourceContext res,
int theShadingType,
PDFDeviceColorSpace theColorSpace,
java.util.List theBackground,
java.util.List theBBox,
boolean theAntiAlias,
int theBitsPerCoordinate,
int theBitsPerComponent,
java.util.List theDecode,
int theVerticesPerRow,
PDFFunction theFunction)
make a Lattice-Form Gouraud mesh shading object |
PDFShading |
makeShading(PDFResourceContext res,
int theShadingType,
PDFDeviceColorSpace theColorSpace,
java.util.List theBackground,
java.util.List theBBox,
boolean theAntiAlias,
java.util.List theDomain,
java.util.List theMatrix,
PDFFunction theFunction)
make a function based shading object |
PDFShading |
makeShading(PDFResourceContext res,
int theShadingType,
PDFDeviceColorSpace theColorSpace,
java.util.List theBackground,
java.util.List theBBox,
boolean theAntiAlias,
java.util.List theCoords,
java.util.List theDomain,
PDFFunction theFunction,
java.util.List theExtend)
Make an axial or radial shading object. |
PDFStream |
makeStream(java.lang.String type,
boolean add)
Make a stream object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 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(int theFunctionType, java.util.List theDomain, java.util.List theRange, java.util.List theSize, int theBitsPerSample, int theOrder, java.util.List theEncode, java.util.List theDecode, java.lang.StringBuffer theFunctionDataStream, java.util.List theFilter)
theDomain
- List objects of Double objects.
This is the domain of the function.
See page 264 of the PDF 1.3 Spec.theRange
- List objects of Double objects.
This is the Range of the function.
See page 264 of the PDF 1.3 Spec.theSize
- A List object of Integer objects.
This is the number of samples in each input dimension.
I can't imagine there being more or less than two input dimensions,
so maybe this should be an array of length 2.
See page 265 of the PDF 1.3 Spec.theBitsPerSample
- An int specifying the number of bits user
to represent each sample value.
Limited to 1,2,4,8,12,16,24 or 32.
See page 265 of the 1.3 PDF Spec.theOrder
- The order of interpolation between samples.
Default is 1 (one). Limited
to 1 (one) or 3, which means linear or cubic-spline interpolation.
This attribute is optional.
See page 265 in the PDF 1.3 spec.theEncode
- List objects of Double objects.
This is the linear mapping of input values intop the domain
of the function's sample table. Default is hard to represent in
ascii, but basically [0 (Size0 1) 0 (Size1 1)...].
This attribute is optional.
See page 265 in the PDF 1.3 spec.theDecode
- List objects of Double objects.
This is a linear mapping of sample values into the range.
The default is just the range.
This attribute is optional.
Read about it on page 265 of the PDF 1.3 spec.theFunctionDataStream
- The sample values that specify
the function are provided in a stream.
This is optional, but is almost always used.
Page 265 of the PDF 1.3 spec has more.theFilter
- This is a vector of String objects which
are the various filters that have are to be
applied to the stream to make sense of it.
Order matters, so watch out.
This is not documented in the Function section of the PDF 1.3 spec,
it was deduced from samples that this is sometimes used, even if we may never
use it in FOP. It is added for completeness sake.theFunctionType
- This is the type of function (0,2,3, or 4).
It should be 0 as this is the constructor for sampled functions.
public PDFFunction makeFunction(int theFunctionType, java.util.List theDomain, java.util.List theRange, java.util.List theCZero, java.util.List theCOne, double theInterpolationExponentN)
theDomain
- List objects of Double objects.
This is the domain of the function.
See page 264 of the PDF 1.3 Spec.theRange
- List of Doubles that is the Range of the function.
See page 264 of the PDF 1.3 Spec.theCZero
- 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.theCOne
- 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.theInterpolationExponentN
- This is the inerpolation exponent.
This attribute is required.
PDF Spec page 268theFunctionType
- The type of the function, which should be 2.
public PDFFunction makeFunction(int theFunctionType, java.util.List theDomain, java.util.List theRange, java.util.List theFunctions, java.util.List theBounds, java.util.List theEncode)
theDomain
- List objects of Double objects.
This is the domain of the function.
See page 264 of the PDF 1.3 Spec.theRange
- List objects of Double objects.
This is the Range of the function.
See page 264 of the PDF 1.3 Spec.theFunctions
- An List of the PDFFunction objects
that the stitching function stitches.
This attributed is required.
It is described on page 269 of the PDF spec.theBounds
- This is a vector of Doubles representing
the numbers that, in conjunction with Domain
define the intervals to which each function from
the 'functions' object applies. It must be in
order of increasing magnitude, and each must be
within Domain.
It basically sets how much of the gradient each function handles.
This attributed is required.
It's described on page 269 of the PDF 1.3 spec.theEncode
- List objects of Double objects.
This is the linear mapping of input values intop the domain
of the function's sample table. Default is hard to represent in
ascii, but basically [0 (Size0 1) 0 (Size1 1)...].
This attribute is required.
See page 270 in the PDF 1.3 spec.theFunctionType
- This is the function type. It should be 3,
for a stitching function.
public PDFFunction makeFunction(int theNumber, int theFunctionType, java.util.List theDomain, java.util.List theRange, java.lang.StringBuffer theFunctionDataStream)
theNumber
- the PDF object numbertheFunctionType
- the type of function to maketheDomain
- the domain valuestheRange
- the range values of the functiontheFunctionDataStream
- a string containing the pdf drawing
public PDFShading makeShading(PDFResourceContext res, int theShadingType, PDFDeviceColorSpace theColorSpace, java.util.List theBackground, java.util.List theBBox, boolean theAntiAlias, java.util.List theDomain, java.util.List theMatrix, PDFFunction theFunction)
res
- the PDF resource context to add the shading, may be nulltheShadingType
- The type of shading object, which should be 1 for function
based shading.theColorSpace
- The colorspace is 'DeviceRGB' or something similar.theBackground
- An array of color components appropriate to the
colorspace key specifying a single color value.
This key is used by the f operator buy ignored by the sh operator.theBBox
- List of double's representing a rectangle
in the coordinate space that is current at the
time of shading is imaged. Temporary clipping
boundary.theAntiAlias
- Whether or not to anti-alias.theDomain
- Optional vector of Doubles specifying the domain.theMatrix
- List of Doubles specifying the matrix.
If it's a pattern, then the matrix maps it to pattern space.
If it's a shading, then it maps it to current user space.
It's optional, the default is the identity matrixtheFunction
- The PDF Function that maps an (x,y) location to a color
public PDFShading makeShading(PDFResourceContext res, int theShadingType, PDFDeviceColorSpace theColorSpace, java.util.List theBackground, java.util.List theBBox, boolean theAntiAlias, java.util.List theCoords, java.util.List theDomain, PDFFunction theFunction, java.util.List theExtend)
res
- the PDF resource context to add the shading, may be nulltheShadingType
- 2 or 3 for axial or radial shadingtheColorSpace
- "DeviceRGB" or similar.theBackground
- theBackground An array of color components appropriate to the
colorspace key specifying a single color value.
This key is used by the f operator buy ignored by the sh operator.theBBox
- List of double's representing a rectangle
in the coordinate space that is current at the
time of shading is imaged. Temporary clipping
boundary.theAntiAlias
- Default is falsetheCoords
- List of four (type 2) or 6 (type 3) DoubletheDomain
- List of Doubles specifying the domaintheFunction
- the Stitching (PDFfunction type 3) function,
even if it's stitching a single functiontheExtend
- List of Booleans of whether to extend the
start and end colors past the start and end points
The default is [false, false]
public PDFShading makeShading(PDFResourceContext res, int theShadingType, PDFDeviceColorSpace theColorSpace, java.util.List theBackground, java.util.List theBBox, boolean theAntiAlias, int theBitsPerCoordinate, int theBitsPerComponent, int theBitsPerFlag, java.util.List theDecode, PDFFunction theFunction)
res
- the PDF resource context to add the shading, may be nulltheShadingType
- 4, 6, or 7 depending on whether it's
Free-form gouraud-shaded triangle meshes, coons patch meshes,
or tensor product patch meshes, respectively.theColorSpace
- "DeviceRGB" or similar.theBackground
- theBackground An array of color components appropriate to the
colorspace key specifying a single color value.
This key is used by the f operator buy ignored by the sh operator.theBBox
- List of double's representing a rectangle
in the coordinate space that is current at the
time of shading is imaged. Temporary clipping
boundary.theAntiAlias
- Default is falsetheBitsPerCoordinate
- 1,2,4,8,12,16,24 or 32.theBitsPerComponent
- 1,2,4,8,12, and 16theBitsPerFlag
- 2,4,8.theDecode
- List of Doubles see PDF 1.3 spec pages 303 to 312.theFunction
- the PDFFunction
public PDFShading makeShading(PDFResourceContext res, int theShadingType, PDFDeviceColorSpace theColorSpace, java.util.List theBackground, java.util.List theBBox, boolean theAntiAlias, int theBitsPerCoordinate, int theBitsPerComponent, java.util.List theDecode, int theVerticesPerRow, PDFFunction theFunction)
res
- the PDF resource context to add the shading, may be nulltheShadingType
- 5 for lattice-Form Gouraud shaded-triangle mesh
without spaces. "Shading1" or "Sh1" are good examples.theColorSpace
- "DeviceRGB" or similar.theBackground
- theBackground An array of color components appropriate to the
colorspace key specifying a single color value.
This key is used by the f operator buy ignored by the sh operator.theBBox
- List of double's representing a rectangle
in the coordinate space that is current at the
time of shading is imaged. Temporary clipping
boundary.theAntiAlias
- Default is falsetheBitsPerCoordinate
- 1,2,4,8,12,16, 24, or 32theBitsPerComponent
- 1,2,4,8,12,24,32theDecode
- List of Doubles. See page 305 in PDF 1.3 spec.theVerticesPerRow
- number of vertices in each "row" of the lattice.theFunction
- The PDFFunction that's mapped on to this shape
public 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 makePattern(PDFResourceContext res, int thePatternType, PDFShading theShading, java.util.List theXUID, java.lang.StringBuffer theExtGState, java.util.List theMatrix)
res
- the PDF resource context to add the shading, may be nullthePatternType
- the type of the pattern, which is 2, smooth shadingtheShading
- the PDF Shading object that comprises this patterntheXUID
- optional:the extended unique Identifier if used.theExtGState
- optional: the extended graphics state, if used.theMatrix
- Optional:List of Doubles that specify the matrix.
public PDFPattern makeGradient(PDFResourceContext res, boolean radial, PDFDeviceColorSpace theColorspace, java.util.List theColors, java.util.List theBounds, java.util.List theCoords, java.util.List theMatrix)
res
- the PDF resource context to add the shading, may be nullradial
- if true a radial gradient will be createdtheColorspace
- the colorspace of the gradienttheColors
- the list of colors for the gradienttheBounds
- the list of bounds associated with the colorstheCoords
- the coordinates for the gradient
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)
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)
target
- The external target. This may be a PDF file name
(optionally with internal page number or destination) or any type of URI.
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, java.lang.String 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 PDFWArray getSubsetWidths(CIDFont cidFont)
public PDFFontDescriptor makeFontDescriptor(FontDescriptor desc)
desc
- the font descriptor
public AbstractPDFStream makeFontFile(FontDescriptor desc)
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
,
org.apache.fop.image.JpegImage
,
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 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()
|
fop 0.95 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |