Package org.apache.pdfbox.cos

Examples of org.apache.pdfbox.cos.COSName


     * Returns the annotations appearance state, which selects the applicable appearance stream
     * from an appearance subdictionary.
     */
    public COSName getAppearanceState()
    {
        COSName name = (COSName) getDictionary().getDictionaryObject(COSName.AS);
        if (name != null)
        {
            return name;
        }
        return null;
View Full Code Here


            return null;
        }

        if (normalAppearance.isSubDictionary())
        {
            COSName state = getAppearanceState();
            return normalAppearance.getSubDictionary().get(state);
        }
        else
        {
            return normalAppearance.getAppearanceStream();
View Full Code Here

   
    private void drawXObject( PDImageXObject xobject, PDResources resources, OutputStream os,
            float x, float y, float width, float height ) throws IOException
    {
        // This is similar to PDPageContentStream.drawXObject()
        COSName xObjectId = resources.add(xobject);

        appendRawCommands( os, SAVE_GRAPHICS_STATE );
        appendRawCommands( os, formatDecimal.format( width ) );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, formatDecimal.format( 0 ) );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, formatDecimal.format( 0 ) );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, formatDecimal.format( height ) );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, formatDecimal.format( x ) );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, formatDecimal.format( y ) );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, CONCATENATE_MATRIX );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, "/" );
        appendRawCommands( os, xObjectId.getName() );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, XOBJECT_DO );
        appendRawCommands( os, SPACE );
        appendRawCommands( os, RESTORE_GRAPHICS_STATE );
    }
View Full Code Here

    protected void processOperator( Operator operator, List arguments ) throws IOException
    {
        String operation = operator.getName();
        if( "Do".equals(operation) )
        {
            COSName objectName = (COSName)arguments.get( 0 );
            PDXObject xobject = getResources().getXObject( objectName );
            if( xobject instanceof PDImageXObject)
            {
                PDImageXObject image = (PDImageXObject)xobject;
                int imageWidth = image.getWidth();
                int imageHeight = image.getHeight();
                System.out.println("*******************************************************************");
                System.out.println("Found image [" + objectName.getName() + "]");
       
                Matrix ctmNew = getGraphicsState().getCurrentTransformationMatrix();
                AffineTransform imageTransform = ctmNew.createAffineTransform();
                imageTransform.scale(1.0 / imageWidth, -1.0 / imageHeight);
                imageTransform.translate(0, -imageHeight);
View Full Code Here

            if (resources == null)
            {
                resources = new PDResources();
                page.setResources(resources);
            }
            COSName xObjectId = createOverlayXObject(page, layoutPage,
                    layoutPage.overlayContentStream);
            array.add(createOverlayStream(page, layoutPage, xObjectId));
        }
    }
View Full Code Here

    {
        List<String> names = null;
        COSBase filters = parameters.getDictionaryObject(COSName.F, COSName.FILTER);
        if (filters instanceof COSName)
        {
            COSName name = (COSName) filters;
            names = new COSArrayList<String>(name.getName(), name, parameters, COSName.FILTER);
        }
        else if (filters instanceof COSArray)
        {
            names = COSArrayList.convertCOSNameCOSArrayToList((COSArray) filters);
        }
View Full Code Here

            COSDictionary aaDict = COSUtils.getAsDictionary(aa, cosDocument);
            if (aaDict != null)
            {
                for (Object key : aaDict.keySet())
                {
                    COSName name = (COSName) key;
                    callCreateAction(aaDict.getItem(name), ctx, result, name.getName(), alreadyCreated);
                }
            }
        }
        return result;
    }
View Full Code Here

        {
            COSDictionary dict = (COSDictionary)obj;
            COSBase itemType = dict.getItem(COSName.TYPE);
            if (itemType instanceof COSName)
            {
                COSName item = (COSName) itemType;
                if (COSName.SIG.equals(item) || COSName.DOC_TIME_STAMP.equals(item))
                {
                    reachedSignature = true;
                }
            }
View Full Code Here

        {
            COSDictionary trailer = doc.getTrailer();
            trailer.setLong(COSName.PREV, doc.getStartXref());
            if (hybridPrev != -1)
            {
                COSName xrefStm = COSName.XREF_STM;
                trailer.removeItem(xrefStm);
                trailer.setLong(xrefStm, getStartxref());
            }
            addXRefEntry(COSWriterXRefEntry.getNullEntry());
   
View Full Code Here

        // arguments are in the wrong spot, so we will silently ignore them
        // if there are no arguments
        if(arguments.size() >= 2)
        {
            // set font and size
            COSName fontName = (COSName)arguments.get(0);
            float fontSize = ((COSNumber)arguments.get(1)).floatValue();
            context.getGraphicsState().getTextState().setFontSize(fontSize);
            PDFont font = context.getResources().getFont(fontName);
            context.getGraphicsState().getTextState().setFont(font);
        }
View Full Code Here

TOP

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

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.