Examples of COSName


Examples of org.pdfbox.cos.COSName

                        if( cert != null )
                        {
                            System.out.println( "Certificate found" );
                            System.out.println( "Name=" + cert.getDictionaryObject( COSName.getPDFName( "Name" ) ) );
                            System.out.println( "Modified=" + cert.getDictionaryObject( COSName.getPDFName( "M" ) ) );
                            COSName subFilter = (COSName)cert.getDictionaryObject( COSName.getPDFName( "SubFilter" ) );
                            if( subFilter != null )
                            {
                                if( subFilter.getName().equals( "adbe.x509.rsa_sha1" ) )
                                {
                                    COSString certString = (COSString)cert.getDictionaryObject(
                                        COSName.getPDFName( "Cert" ) );
                                    byte[] certData = certString.getBytes();
                                    CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
                                    ByteArrayInputStream certStream = new ByteArrayInputStream( certData );
                                    Collection certs = factory.generateCertificates( certStream );
                                    System.out.println( "certs=" + certs );
                                }
                                else if( subFilter.getName().equals( "adbe.pkcs7.sha1" ) )
                                {
                                    COSString certString = (COSString)cert.getDictionaryObject(
                                        COSName.getPDFName( "Contents" ) );
                                    byte[] certData = certString.getBytes();
                                    CertificateFactory factory = CertificateFactory.getInstance( "X.509" );
View Full Code Here

Examples of org.pdfbox.cos.COSName

            if( n instanceof COSDictionary )
            {
                List li = ((COSDictionary)n).keyList();
                for( int i=0; i<li.size(); i++ )
                {
                    COSName name = (COSName)li.get( i );
                    if( !name.equals( OFF_VALUE ))
                    {
                        value = name;
                    }
                }
               
View Full Code Here

Examples of org.pdfbox.cos.COSName

     */
    public boolean isChecked()
    {
        boolean retval = false;
        String onValue = getOnValue();
        COSName radioValue = (COSName)getDictionary().getDictionaryObject( KEY );
        if( radioValue != null && value != null && radioValue.getName().equals( onValue ) )
        {
            retval = true;
        }
       
        return retval;
View Full Code Here

Examples of org.pdfbox.cos.COSName

        throws IOException
    {
        Object retval = null;
        if( dictionary != null )
        {
            COSName filter = (COSName)dictionary.getDictionaryObject( COSName.FILTER );
            Class handlerClass = (Class)handlerMap.get( filter );
            if( handlerClass == null )
            {
                throw new IOException( "No handler for security handler '" + filter.getName() + "'" );
            }
            else
            {
                try
                {
View Full Code Here

Examples of org.pdfbox.cos.COSName

    {
        PageDrawer drawer = (PageDrawer)context;
        PDPage page = drawer.getPage();
        Dimension pageSize = drawer.getPageSize();
        Graphics2D graphics = drawer.getGraphics();
        COSName objectName = (COSName)arguments.get( 0 );
        Map xobjects = drawer.getResources().getXObjects();
        PDXObject xobject = (PDXObject)xobjects.get( objectName.getName() );
        if( xobject instanceof PDXObjectImage )
        {
            PDXObjectImage image = (PDXObjectImage)xobject;
            try
            {
View Full Code Here

Examples of org.pdfbox.cos.COSName

        throws CryptographyException, IOException
    {
        Iterator keys = dictionary.keyList().iterator();
        while( keys.hasNext() )
        {
            COSName key = (COSName)keys.next();
            Object value = dictionary.getItem( key );
            //if we are a signature dictionary and contain a Contents entry then
            //we don't decrypt it.
            if( !(key.getName().equals( "Contents" ) &&
                  value instanceof COSString &&
                  potentialSignatures.contains( dictionary )))
            {
                decrypt( value, objNum, genNum );
            }
View Full Code Here

Examples of org.pdfbox.cos.COSName

     * @throws Exception If there is an exception while parsing.
     */
    public void testCOSName() throws Exception
    {
        TestParser parser = new TestParser(new ByteArrayInputStream( "/PANTONE#20116#20CV".getBytes() ) );
        COSName name = parser.parseCOSName();
        assertTrue("Failed to parse COSName",name.getName().equals( "PANTONE 116 CV" ));
       
    }
View Full Code Here

Examples of org.pdfbox.cos.COSName

        {
            Map actualMap = new HashMap();
            Iterator keyIter = map.keyList().iterator();
            while( keyIter.hasNext() )
            {
                COSName key = (COSName)keyIter.next();
                COSBase cosObj = map.getDictionaryObject( key );
                Object actualObject = null;
                if( cosObj instanceof COSString )
                {
                    actualObject = ((COSString)cosObj).getString();
                }
                else if( cosObj instanceof COSInteger )
                {
                    actualObject = new Integer( ((COSInteger)cosObj).intValue() );
                }
                else if( cosObj instanceof COSName )
                {
                    actualObject = ((COSName)cosObj).getName();
                }
                else if( cosObj instanceof COSFloat )
                {
                    actualObject = new Float( ((COSInteger)cosObj).floatValue() );
                }
                else if( cosObj instanceof COSBoolean )
                {
                    actualObject = ((COSBoolean)cosObj).getValue() ? Boolean.TRUE : Boolean.FALSE;
                }
                else
                {
                    throw new IOException( "Error:unknown type of object to convert:" + cosObj );
                }
                actualMap.put( key.getName(), actualObject );
            }
            retval = new COSDictionaryMap( actualMap, map );
        }
       
        return retval;
View Full Code Here

Examples of org.pdfbox.cos.COSName

    {
        List retval = null;
        COSBase filters = stream.getFilters();
        if( filters instanceof COSName )
        {
            COSName name = (COSName)filters;
            retval = new COSArrayList( name.getName(), name, stream, "Filter" );
        }
        else if( filters instanceof COSArray )
        {
            retval = COSArrayList.convertCOSNameCOSArrayToList( (COSArray)filters );
        }
View Full Code Here

Examples of org.pdfbox.cos.COSName

    {
        List retval = null;
        COSBase filters = stream.getDictionaryObject( "FFilter" );
        if( filters instanceof COSName )
        {
            COSName name = (COSName)filters;
            retval = new COSArrayList( name.getName(), name, stream, "FFilter" );
        }
        else if( filters instanceof COSArray )
        {
            retval = COSArrayList.convertCOSNameCOSArrayToList( (COSArray)filters );
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.