Class 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 Details

  • Constructor Details

    • PDFPage

      public PDFPage(PDFFile pFile)
      Creates a PDF page for the page tree and pfile.
  • Method Details

    • 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 Map getResourceMap(String aResourceName)
      Returns the named resource dict for this page.
    • getExtGStateMap

      public Map getExtGStateMap()
      Returns the ExtGState dict for this page.
    • addExtGState

      public void addExtGState(String aName, Map aMap)
      Adds a named graphics state parameter dict to the ExtGState dict for this page.
    • addColorspace

      public String addColorspace(Object cspace)
      Adds a new colorspace to the resource dict and returns the name by which it's referred.
    • addPattern

      public String addPattern(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.