Package org.apache.pdfbox.pdmodel.common

Examples of org.apache.pdfbox.pdmodel.common.PDMatrix


            textPos.setValue(2, 1, 0);
            // because of the moved 0,0-reference, we have to shear in the opposite direction
            textPos.setValue(0, 1, (-1)*textPos.getValue(0, 1));
            textPos.setValue(1, 0, (-1)*textPos.getValue(1, 0));
            AffineTransform at = textPos.createAffineTransform();
            PDMatrix fontMatrix = font.getFontMatrix();
            at.scale(fontMatrix.getValue(0, 0) * 1000f, fontMatrix.getValue(1, 0) * 1000f);
            graphics.setClip(getGraphicsState().getCurrentClippingPath());
            font.drawString( text.getCharacter(), graphics, text.getFontSize(), at, x, y );
        }
        catch( IOException io )
        {
View Full Code Here


     *
     * @return The linear interpretation matrix.
     */
    public PDMatrix getLinearInterpretation()
    {
        PDMatrix retval = null;
        COSArray matrix = (COSArray)dictionary.getDictionaryObject( COSName.MATRIX );
        if( matrix == null )
        {
            retval = new PDMatrix();
            setLinearInterpretation( retval );
        }
        else
        {
            retval = new PDMatrix( matrix );
        }
        return retval;
    }
View Full Code Here

            textPos.setValue(2, 1, 0);
            // because of the moved 0,0-reference, we have to shear in the opposite direction
            textPos.setValue(0, 1, (-1)*textPos.getValue(0, 1));
            textPos.setValue(1, 0, (-1)*textPos.getValue(1, 0));
            AffineTransform at = textPos.createAffineTransform();
            PDMatrix fontMatrix = font.getFontMatrix();
            at.scale(fontMatrix.getValue(0, 0) * 1000f, fontMatrix.getValue(1, 1) * 1000f);
            //TODO setClip() is a massive performance hot spot. Investigate optimization possibilities
            graphics.setClip(graphicsState.getCurrentClippingPath());
            // the fontSize is no longer needed as it is already part of the transformation
            // we should remove it from the parameter list in the long run
            font.drawString( text.getCharacter(), text.getCodePoints(), graphics, 1, at, x, y );
View Full Code Here

                array.add( COSInteger.ZERO );
                array.add( new COSFloat( 0.001f ) );
                array.add( COSInteger.ZERO );
                array.add( COSInteger.ZERO );
            }
            fontMatrix = new PDMatrix(array);
        }
        return fontMatrix;
    }
View Full Code Here

     *
     * @return The matrix to transform from glyph space to text space.
     */
    public PDMatrix getFontMatrix()
    {
        PDMatrix matrix = null;
        COSArray array = (COSArray)font.getDictionaryObject( COSName.FONT_MATRIX );
        if( array == null )
        {
            array = new COSArray();
            array.add( new COSFloat( 0.001f ) );
            array.add( COSInteger.ZERO );
            array.add( COSInteger.ZERO );
            array.add( new COSFloat( 0.001f ) );
            array.add( COSInteger.ZERO );
            array.add( COSInteger.ZERO );
        }
        matrix = new PDMatrix(array);

        return matrix;
    }
View Full Code Here

                COSArray array = new COSArray();
                for(Number number : numbers)
                {
                    array.add(new COSFloat(number.floatValue()));
                }
                this.fontMatrix = new PDMatrix(array);
            }
            else
            {
                this.fontMatrix = super.getFontMatrix();
            }
View Full Code Here

            textPos.setValue(2, 1, 0);
            // because of the moved 0,0-reference, we have to shear in the opposite direction
            textPos.setValue(0, 1, (-1)*textPos.getValue(0, 1));
            textPos.setValue(1, 0, (-1)*textPos.getValue(1, 0));
            AffineTransform at = textPos.createAffineTransform();
            PDMatrix fontMatrix = font.getFontMatrix();
            at.scale(fontMatrix.getValue(0, 0) * 1000f, fontMatrix.getValue(1, 0) * 1000f);
            graphics.setClip(getGraphicsState().getCurrentClippingPath());
            font.drawString( text.getCharacter(), graphics, text.getFontSize(), at, x, y );
        }
        catch( IOException io )
        {
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdmodel.common.PDMatrix

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.