Class PDFPage
- java.lang.Object
-
- com.inductiveautomation.rm.pdf.writer.PDFBuffer
-
- com.inductiveautomation.rm.pdf.writer.PDFPage
-
public class PDFPage extends PDFBuffer
All drawing happens in PDFPage object. Contents is a stream to which all the marking functions get appended.
-
-
Field Summary
Fields Modifier and Type Field Description static byteOPACITY_FILL_ONLYstatic byteOPACITY_SHAPEstatic byteOPACITY_STROKE_AND_FILLstatic byteOPACITY_STROKE_ONLY
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotation(PDFAnnotation annot)Adds an annotation to the page.java.lang.StringaddColorspace(java.lang.Object cspace)Adds a new colorspace to the resource dict and returns the name by which it's referred.voidaddExtGState(java.lang.String aName, java.util.Map aMap)Adds a named graphics state parameter dict to the ExtGState dict for this page.java.lang.StringaddPattern(java.lang.Object aPattern)Adds a new pattern to the resource dict and returns the name by which it's referred.voidcloseContents(RMPDFWriter aWriter)Caches compressed contents into _stream and releases contents for efficiency.PDFAnnotationgetAnnotation(int anIndex)Returns the specific page annotation at the given index.intgetAnnotationCount()Returns the number of annotations.java.util.MapgetExtGStateMap()Returns the ExtGState dict for this page.java.util.MapgetResourceMap(java.lang.String aResourceName)Returns the named resource dict for this page.voidgrestore()Restores the last graphics state of the writer.voidgsave()Saves the current graphics state of the writer.voidresolvePageReferences(PDFPagesTree pages)Resolves page references for page annotations.voidsetCropBox(RMRect aRect)Sets the crop box for the page.voidsetFillColor(RMColor aColor)Sets the given color to be the current fill color.voidsetLineCap(int aLineCap)Sets the line cap: 0=butt, 1=round, 2=square.voidsetLineJoin(int aLineJoin)Sets the line join: 0=miter, 1=round, 2=bevel.voidsetMediaBox(RMRect aRect)Sets the media box for the page.voidsetOpacity(float anOpacity, byte coverage)Sets the opacity to be the following value, for stroke operations, fill operations or both.voidsetStrokeColor(RMColor aColor)Sets the given color to be the current stroke color.voidsetStrokeWidth(float aWidth)Sets the given line width to be the current line width.voidwritePDF(RMPDFWriter aWriter)Writes the page contents to the pdf buffer.
-
-
-
Field Detail
-
OPACITY_STROKE_ONLY
public static final byte OPACITY_STROKE_ONLY
- See Also:
- Constant Field Values
-
OPACITY_STROKE_AND_FILL
public static final byte OPACITY_STROKE_AND_FILL
- See Also:
- Constant Field Values
-
OPACITY_FILL_ONLY
public static final byte OPACITY_FILL_ONLY
- See Also:
- Constant Field Values
-
OPACITY_SHAPE
public static final byte OPACITY_SHAPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PDFPage
public PDFPage(PDFFile pFile)
Creates a PDF page for the page tree and pfile.
-
-
Method Detail
-
setMediaBox
public void setMediaBox(RMRect aRect)
Sets the media box for the page.
-
setCropBox
public void setCropBox(RMRect aRect)
Sets the crop box for the page.
-
setFillColor
public void setFillColor(RMColor aColor)
Sets the given color to be the current fill color.
-
setStrokeColor
public void setStrokeColor(RMColor aColor)
Sets the given color to be the current stroke color.
-
setStrokeWidth
public void setStrokeWidth(float aWidth)
Sets the given line width to be the current line width.
-
setLineCap
public void setLineCap(int aLineCap)
Sets the line cap: 0=butt, 1=round, 2=square.
-
setLineJoin
public void setLineJoin(int aLineJoin)
Sets the line join: 0=miter, 1=round, 2=bevel.
-
setOpacity
public void setOpacity(float anOpacity, byte coverage)Sets the opacity to be the following value, for stroke operations, fill operations or both. Stupidly, there's no setOpacity or setRGBAColor op in PDF, so you have to modify the gstate parameter dict directly using the generic graphics state operator gs, which takes a name of a gstate map in page's ExtGState map (we have to add this silly little gstate map manually for each unique opacity).
-
gsave
public void gsave()
Saves the current graphics state of the writer.
-
grestore
public void grestore()
Restores the last graphics state of the writer.
-
getAnnotationCount
public int getAnnotationCount()
Returns the number of annotations.
-
getAnnotation
public PDFAnnotation getAnnotation(int anIndex)
Returns the specific page annotation at the given index.
-
addAnnotation
public void addAnnotation(PDFAnnotation annot)
Adds an annotation to the page.
-
getResourceMap
public java.util.Map getResourceMap(java.lang.String aResourceName)
Returns the named resource dict for this page.
-
getExtGStateMap
public java.util.Map getExtGStateMap()
Returns the ExtGState dict for this page.
-
addExtGState
public void addExtGState(java.lang.String aName, java.util.Map aMap)Adds a named graphics state parameter dict to the ExtGState dict for this page.
-
addColorspace
public java.lang.String addColorspace(java.lang.Object cspace)
Adds a new colorspace to the resource dict and returns the name by which it's referred.
-
addPattern
public java.lang.String addPattern(java.lang.Object aPattern)
Adds a new pattern to the resource dict and returns the name by which it's referred.
-
resolvePageReferences
public void resolvePageReferences(PDFPagesTree pages)
Resolves page references for page annotations.
-
closeContents
public void closeContents(RMPDFWriter aWriter)
Caches compressed contents into _stream and releases contents for efficiency.
-
writePDF
public void writePDF(RMPDFWriter aWriter)
Writes the page contents to the pdf buffer.
-
-