Class PdfCleanUpContentOperator

    • Field Detail

      • TStar

        private static final byte[] TStar
      • Tw

        private static final byte[] Tw
      • TcTStar

        private static final byte[] TcTStar
      • TJ

        private static final byte[] TJ
      • Tc

        private static final byte[] Tc
      • m

        private static final byte[] m
      • l

        private static final byte[] l
      • c

        private static final byte[] c
      • h

        private static final byte[] h
      • S

        private static final byte[] S
      • f

        private static final byte[] f
      • eoF

        private static final byte[] eoF
      • n

        private static final byte[] n
      • W

        private static final byte[] W
      • eoW

        private static final byte[] eoW
      • q

        private static final byte[] q
      • Q

        private static final byte[] Q
      • cs

        private static final byte[] cs
      • textShowingOperators

        private static final java.util.Set<java.lang.String> textShowingOperators
      • pathConstructionOperators

        private static final java.util.Set<java.lang.String> pathConstructionOperators
      • strokeOperators

        private static final java.util.Set<java.lang.String> strokeOperators
      • nwFillOperators

        private static final java.util.Set<java.lang.String> nwFillOperators
      • eoFillOperators

        private static final java.util.Set<java.lang.String> eoFillOperators
      • pathPaintingOperators

        private static final java.util.Set<java.lang.String> pathPaintingOperators
      • clippingPathOperators

        private static final java.util.Set<java.lang.String> clippingPathOperators
      • lineStyleOperators

        private static final java.util.Set<java.lang.String> lineStyleOperators
      • strokeColorOperators

        private static final java.util.Set<java.lang.String> strokeColorOperators
      • originalContentOperator

        protected ContentOperator originalContentOperator
    • Method Detail

      • invoke

        public void invoke​(PdfContentStreamProcessor pdfContentStreamProcessor,
                           PdfLiteral operator,
                           java.util.ArrayList<PdfObject> operands)
                    throws java.lang.Exception
        Description copied from interface: ContentOperator
        Invokes a content operator.
        Specified by:
        invoke in interface ContentOperator
        Parameters:
        pdfContentStreamProcessor - the processor that is dealing with the PDF content
        operator - the literal PDF syntax of the operator
        operands - the operands that come with the operator
        Throws:
        java.lang.Exception - any exception can be thrown - it will be re-packaged into a runtime exception and re-thrown by the PdfContentStreamProcessor
      • writeOperands

        private void writeOperands​(PdfContentByte canvas,
                                   java.util.List<PdfObject> operands)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • allChunksAreVisible

        private boolean allChunksAreVisible​(java.util.List<PdfCleanUpContentChunk> chunks)
      • toPdf

        private static void toPdf​(PdfObject object,
                                  PdfWriter writer,
                                  java.io.OutputStream os)
                           throws java.io.IOException
        Overriding standard PdfObject.toPdf because we need sorted PdfDictionaries.
        Throws:
        java.io.IOException
      • structureTJarray

        private java.util.Map<java.lang.Integer,​java.lang.Float> structureTJarray​(PdfArray array)
        Example. TJ = [(h) 3 4 (q) 7 (w) (e)] Result = {0:0, 1:7, 2:7, 3:0, 4:0}
        Returns:
        Map whose key is an ordinal number of the string in the TJ array and value is the position adjustment.
      • writeTextChunks

        private void writeTextChunks​(java.util.Map<java.lang.Integer,​java.lang.Float> structuredTJoperands,
                                     java.util.List<PdfCleanUpContentChunk> chunks,
                                     PdfContentByte canvas,
                                     float characterSpacing,
                                     float wordSpacing,
                                     float fontSize,
                                     float horizontalScaling)
                              throws java.io.IOException
        Renders parts of text which are visible.
        Throws:
        java.io.IOException
      • getUnscaledTextChunkWidth

        private float getUnscaledTextChunkWidth​(PdfCleanUpContentChunk.Text chunk,
                                                float characterSpacing,
                                                float wordSpacing,
                                                float fontSize,
                                                float horizontalScaling)
        We get into this method when the current chunk is not visible. Here we are calculating a piece of the Tj coefficient for a previous visible chunk. For details see PDF spec., Text Space Details, formula for "tx" coefficient and TextRenderInfo class (getUnscaledBaseline)
      • writePath

        private void writePath​(java.lang.String operatorStr,
                               PdfContentByte canvas,
                               PdfName strokeColorSpace)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writePath

        private void writePath​(Path path,
                               byte[] pathPaintingOperator,
                               PdfContentByte canvas)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeMoveTo

        private void writeMoveTo​(Point2D destinationPoint,
                                 PdfContentByte canvas)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writeBezierCurve

        private void writeBezierCurve​(BezierCurve curve,
                                      PdfContentByte canvas)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLine

        private void writeLine​(Line line,
                               PdfContentByte canvas)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeStroke

        private void writeStroke​(PdfContentByte canvas,
                                 Path path,
                                 PdfName strokeColorSpace)
                          throws java.io.IOException
        Throws:
        java.io.IOException