Package org.pdfbox.cos

Examples of org.pdfbox.cos.COSInteger


    {
        float fontWidth = 0;
        int code = getCodeFromArray( c, offset, length );

        //hmm should this be in a subclass??
        COSInteger firstChar = (COSInteger)font.getDictionaryObject( COSName.FIRSTCHAR );
        COSInteger lastChar = (COSInteger)font.getDictionaryObject( COSName.LASTCHAR );
        if( firstChar != null && lastChar != null )
        {
            long first = firstChar.intValue();
            long last = lastChar.intValue();
            if( code >= first && code <= last && font.getDictionaryObject( COSName.WIDTHS ) != null )
            {
                COSArray widthArray = (COSArray)font.getDictionaryObject( COSName.WIDTHS );
                COSNumber fontWidthObject = (COSNumber)widthArray.get( (int)(code - first) );
                fontWidth = fontWidthObject.floatValue();
View Full Code Here


            baos.write(b);
        }

        COSDictionary streamDict = new COSDictionary();
        streamDict.setItem(COSName.LENGTH, new COSInteger(baos.size()));
        COSStream output = new COSStream(streamDict, pdfDocument.getDocument().getScratchFile());
        output.setFilters(stream.getFilters());
        OutputStream os = output.createUnfilteredStream();
        baos.writeTo(os);
        os.close();
View Full Code Here

     *
     * @param rotation The new rotation for this page.
     */
    public void setRotation( int rotation )
    {
        page.setItem( COSName.getPDFName( "Rotate" ), new COSInteger( rotation ) );
    }
View Full Code Here

        {
            resources.removeItem( key );
        }
        else
        {
            resources.setItem( key, new COSInteger( value.longValue() ) );
        }
    }
View Full Code Here

    {
        getStandardOutput().write(TRAILER);
        getStandardOutput().writeEOL();

        COSDictionary trailer = doc.getTrailer();
        trailer.setItem(COSName.getPDFName("Size"), new COSInteger( getXRefEntries().size()+1));
        trailer.removeItem( COSName.PREV );
        /**
        COSObject catalog = doc.getCatalog();
        if (catalog != null)
        {
View Full Code Here

    {
        try
        {
            InputStream input = obj.getFilteredStream();
            // set the length of the stream and write stream dictionary
            COSInteger length = new COSInteger( input.available() );
            obj.getDictionary().setItem(COSName.LENGTH, length);
            obj.getDictionary().accept(this);
            // write the stream content
            getStandardOutput().write(STREAM);
            getStandardOutput().writeCRLF();
View Full Code Here

    public void writeText( PDDocument doc, Writer outputStream ) throws IOException
    {
        COSDictionary encrypted = doc.getDocument().getEncryptionDictionary();
        if( encrypted != null )
        {
            COSInteger p = (COSInteger)encrypted.getDictionaryObject( COSName.getPDFName( "P" ) );
            long pVal = p.intValue();
            if( (pVal & 16) == 0 )
            {
                throw new IOException( "You do not have permission to extract text" );
            }
        }
View Full Code Here

        document.addObject( pagesObject );
        rootDictionary.setItem( COSName.getPDFName( "Pages" ), pagesObject );
        pages.setItem( COSName.getPDFName( "Type" ), COSName.getPDFName( "Pages" ) );
        COSArray kidsArray = new COSArray();
        pages.setItem( COSName.getPDFName( "Kids" ), kidsArray );
        pages.setItem( COSName.getPDFName( "Count" ), new COSInteger( 0 ) );
    }
View Full Code Here

TOP

Related Classes of org.pdfbox.cos.COSInteger

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.