Class PageDrawer

    • Constructor Detail

      • PageDrawer

        public PageDrawer​(PageDrawerParameters parameters)
                   throws IOException
        Constructor.
        Parameters:
        parameters - Parameters for page drawing.
        Throws:
        IOException - If there is an error loading properties from the file.
    • Method Detail

      • getAnnotationFilter

        public AnnotationFilter getAnnotationFilter()
        Return the AnnotationFilter.
        Returns:
        the AnnotationFilter
      • setAnnotationFilter

        public void setAnnotationFilter​(AnnotationFilter annotationFilter)
        Set the AnnotationFilter.

        Allows to only render annotation accepted by the filter.

        Parameters:
        annotationFilter - the AnnotationFilter
      • getRenderer

        public final PDFRenderer getRenderer()
        Returns the parent renderer.
      • getCanvas

        protected final Canvas getCanvas()
        Returns the underlying Canvas. May be null if drawPage has not yet been called.
      • getLinePath

        protected final Path getLinePath()
        Returns the current line path. This is reset to empty after each fill/stroke.
      • drawPage

        public void drawPage​(Paint p,
                             Canvas c,
                             PDRectangle pageSize)
                      throws IOException
        Draws the page to the requested Canvas.
        Parameters:
        p - The paint.
        c - The canvas to draw onto.
        pageSize - The size of the page to draw.
        Throws:
        IOException - If there is an IO error while drawing the page.
      • setClip

        protected final void setClip()
        Sets the clipping path using caching for performance. We track lastClip manually because Graphics2D#getClip() returns a new object instead of the same one passed to setClip(). You may need to call this if you override showGlyph(). See PDFBOX-5093 for more.
      • beginText

        public void beginText()
                       throws IOException
        Description copied from class: PDFStreamEngine
        Called when the BT operator is encountered. This method is for overriding in subclasses, the default implementation does nothing.
        Overrides:
        beginText in class PDFStreamEngine
        Throws:
        IOException - if there was an error processing the text
      • endText

        public void endText()
                     throws IOException
        Description copied from class: PDFStreamEngine
        Called when the ET operator is encountered. This method is for overriding in subclasses, the default implementation does nothing.
        Overrides:
        endText in class PDFStreamEngine
        Throws:
        IOException - if there was an error processing the text
      • showFontGlyph

        protected void showFontGlyph​(Matrix textRenderingMatrix,
                                     PDFont font,
                                     int code,
                                     Vector displacement)
                              throws IOException
        Description copied from class: PDFStreamEngine
        Called when a glyph is to be processed. This method is intended for overriding in subclasses, the default implementation does nothing.
        Overrides:
        showFontGlyph in class PDFStreamEngine
        Parameters:
        textRenderingMatrix - the current text rendering matrix, Trm
        font - the current font
        code - internal PDF character code for the glyph
        displacement - the displacement (i.e. advance) of the glyph in text space
        Throws:
        IOException - if the glyph cannot be processed
      • showType3Glyph

        protected void showType3Glyph​(Matrix textRenderingMatrix,
                                      PDType3Font font,
                                      int code,
                                      Vector displacement)
                               throws IOException
        Description copied from class: PDFStreamEngine
        Called when a glyph is to be processed. This method is intended for overriding in subclasses, the default implementation does nothing.
        Overrides:
        showType3Glyph in class PDFStreamEngine
        Parameters:
        textRenderingMatrix - the current text rendering matrix, Trm
        font - the current font
        code - internal PDF character code for the glyph
        displacement - the displacement (i.e. advance) of the glyph in text space
        Throws:
        IOException - if the glyph cannot be processed
      • clip

        public void clip​(Path.FillType windingRule)
        Description copied from class: PDFGraphicsStreamEngine
        Modify the current clipping path by intersecting it with the current path. The clipping path will not be updated until the succeeding painting operator is called.
        Specified by:
        clip in class PDFGraphicsStreamEngine
        Parameters:
        windingRule - The winding rule which will be used for clipping.
      • moveTo

        public void moveTo​(float x,
                           float y)
        Description copied from class: PDFGraphicsStreamEngine
        Starts a new path at (x,y).
        Specified by:
        moveTo in class PDFGraphicsStreamEngine
        Parameters:
        x - x-coordinate of the target point.
        y - y-coordinate of the target point.
      • lineTo

        public void lineTo​(float x,
                           float y)
        Description copied from class: PDFGraphicsStreamEngine
        Draws a line from the current point to (x,y).
        Specified by:
        lineTo in class PDFGraphicsStreamEngine
        Parameters:
        x - x-coordinate of the end point of the line.
        y - y-coordinate of the end point of the line.
      • curveTo

        public void curveTo​(float x1,
                            float y1,
                            float x2,
                            float y2,
                            float x3,
                            float y3)
        Description copied from class: PDFGraphicsStreamEngine
        Draws a curve from the current point to (x3,y3) using (x1,y1) and (x2,y2) as control points.
        Specified by:
        curveTo in class PDFGraphicsStreamEngine
        Parameters:
        x1 - x-coordinate of the first control point.
        y1 - y-coordinate of the first control point.
        x2 - x-coordinate of the second control point.
        y2 - y-coordinate of the second control point.
        x3 - x-coordinate of the end point of the curve.
        y3 - y-coordinate of the end point of the curve.
      • setStroke

        public void setStroke​(Paint p,
                              float width,
                              Paint.Cap cap,
                              Paint.Join join,
                              float miterLimit,
                              float[] dash,
                              float dash_phase)
      • showTransparencyGroupOnCanvas

        protected void showTransparencyGroupOnCanvas​(PDTransparencyGroup form,
                                                     Canvas canvas)
                                              throws IOException
        For advanced users, to extract the transparency group into a separate graphics device.
        Parameters:
        form -
        canvas -
        Throws:
        IOException
      • beginMarkedContentSequence

        public void beginMarkedContentSequence​(COSName tag,
                                               COSDictionary properties)
        Called when a marked content group begins
        Overrides:
        beginMarkedContentSequence in class PDFStreamEngine
        Parameters:
        tag - indicates the role or significance of the sequence
        properties - optional properties