Class PDFPageBuffer

  • All Implemented Interfaces:
    RMArchiver.Archiving, java.lang.Cloneable

    public class PDFPageBuffer
    extends PDFBuffer
    This class is a subclass of PDFBuffer, that knows how to write an RMPage and its shapes. It maintains graphics state to avoid unnecessary marking operators.
    • Constructor Detail

      • PDFPageBuffer

        public PDFPageBuffer​(PDFPage aPage)
        Creates a new PDFWriter.
    • Method Detail

      • getPage

        public PDFPage getPage()
        Returns the pdf page for this page bufer.
      • writeShapeFill

        public void writeShapeFill​(RMShape aShape,
                                   RMFill aFill,
                                   RMPath aPath,
                                   PDFFile pFile)
        Writes PDF for an individual shape fill.
      • writeStroke

        public void writeStroke​(RMStroke aStroke,
                                RMPath aPath)
        Writes PDF for a plain RMStroke.
      • writeFill

        public void writeFill​(RMFill aFill,
                              RMPath aPath)
        Writes PDF for a plain RMFill.
      • setFillColor

        public void setFillColor​(RMColor aColor)
        Sets the given color to be the current fill color.
      • writeGradientFill

        public void writeGradientFill​(RMGradientFill gradient,
                                      RMShape aShape,
                                      RMPath aPath)
        Writes pdf for the path filled with a shading pattern defined by the RMGradientFill
      • setShading

        public void setShading​(RMGradientFill gradient,
                               RMShape aShape,
                               RMPath aPath)
        Sets the current shading pattern to the gradient specified by the given RMGradientFill
      • setStrokeColor

        public void setStrokeColor​(RMColor aColor)
        Sets the given color to be the current stroke color.
      • 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).
      • setStrokeWidth

        public void setStrokeWidth​(float aWidth)
        Sets the given line width to be the current line width.
      • setLineCap

        public void setLineCap​(int cap)
        Sets the line cap: 0=butt, 1=round, 2=square.
      • setLineJoin

        public void setLineJoin​(int join)
        Sets the line join: 0=miter, 1=round, 2=bevel
      • gsave

        public void gsave()
        Saves the current graphics state of the writer.
      • grestore

        public void grestore()
        Restores the last graphics state of the writer.