Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSFloat


            stream.getStream().setItem(COSName.RANGE, rangeArray);
        }
        // extend range array with default values if needed
        while (rangeArray.size() < (n + 1) * 2)
        {
            rangeArray.add(new COSFloat(0));
            rangeArray.add(new COSFloat(1));
        }
        rangeArray.set(n*2, new COSFloat(range.getMin()));
        rangeArray.set(n*2+1, new COSFloat(range.getMax()));
    }
View Full Code Here


        matrix = new COSArray();
        double[] values = new double[6];
        transform.getMatrix(values);
        for (double v : values)
        {
            matrix.add(new COSFloat((float)v));
        }
        getCOSDictionary().setItem(COSName.MATRIX, matrix);
    }
View Full Code Here

            C0 = (COSArray)getDictionary().getDictionaryObject( COSName.C0 );
            if ( C0 == null )
            {
                // C0 is optional, default = 0
                C0 = new COSArray();
                C0.add( new COSFloat( 0 ) );
            }
        }
        return C0;
    }
View Full Code Here

            C1 = (COSArray)getDictionary().getDictionaryObject( COSName.C1 );
            if( C1 == null )
            {
                // C1 is optional, default = 1
                C1 = new COSArray();
                C1.add( new COSFloat( 1 ) );
            }     
        }           
        return C1;
    }
View Full Code Here

        COSArray matrix = new COSArray();
        double[] values = new double[6];
        transform.getMatrix(values);
        for (double v : values)
        {
            matrix.add(new COSFloat((float) v));
        }
        getCOSDictionary().setItem(COSName.MATRIX, matrix);
    }
View Full Code Here

                    {
                        array.add( COSInteger.get( ((Number)next).longValue() ) );
                    }
                    else if( next instanceof Float || next instanceof Double )
                    {
                        array.add( new COSFloat( ((Number)next).floatValue() ) );
                    }
                    else if( next instanceof COSObjectable )
                    {
                        COSObjectable object = (COSObjectable)next;
                        array.add( object.getCOSObject() );
View Full Code Here

        {
            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 );
            }
            fontMatrix = new PDMatrix(array);
        }
View Full Code Here

                                {
                                    try
                                    {
                                        for (int i=0;i<6;i++)
                                        {
                                            COSFloat floatValue = new COSFloat(Float.parseFloat(st.nextToken()));
                                            array.add(floatValue);
                                        }
                                    }
                                    catch (NumberFormatException exception)
                                    {
                                        log.error("Can't read the fontmatrix from embedded font file!");
                                    }
                                    fontMatrix = new PDMatrix(array);
                                }
                            }
                            else
                            {
                                // there are fonts where all values are on a separate line, see PDFBOX-1611
                                COSArray array = new COSArray();
                                while((line = in.readLine()) != null)
                                {
                                    if (line.startsWith("["))
                                    {
                                        continue;
                                    }
                                    if (line.endsWith("]"))
                                    {
                                        break;
                                    }
                                    try
                                    {
                                        COSFloat floatValue = new COSFloat(Float.parseFloat(line));
                                        array.add(floatValue);
                                    }
                                    catch (NumberFormatException exception)
                                    {
                                        log.error("Can't read the fontmatrix from embedded font file!");
View Full Code Here

                                drawnString.reset();
                                drawnString.append( apValue.getBytes("ISO-8859-1") );
                            }
                        }
                        int setFontIndex = tokens.indexOf( PDFOperator.getOperator( "Tf" ));
                        tokens.set( setFontIndex-1, new COSFloat( fontSize ) );
                        if( foundString )
                        {
                            writer.writeTokens( tokens );
                        }
                        else
View Full Code Here

            List<Object> daTokens = daParser.getTokens();
            fontSize = calculateFontSize( pdFont, boundingBox, tokens, daTokens );
            int fontIndex = daTokens.indexOf( PDFOperator.getOperator( "Tf" ) );
            if(fontIndex != -1 )
            {
                daTokens.set( fontIndex-1, new COSFloat( fontSize ) );
            }
            ContentStreamWriter daWriter = new ContentStreamWriter(output);
            daWriter.writeTokens( daTokens );
        }
        printWriter.println( getTextPosition( boundingBox, pdFont, fontSize, tokens ) );
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.cos.COSFloat

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.