Package org.pdfbox.pdmodel.common.filespecification

Examples of org.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification


     * {@inheritDoc}
     */
    protected Object convertCOSToPD( COSBase base ) throws IOException
    {
        COSBase destination = base;
        return new PDComplexFileSpecification( (COSDictionary)destination );
    }
View Full Code Here


            //embedded files are stored in a named tree
            PDEmbeddedFilesNameTreeNode efTree = new PDEmbeddedFilesNameTreeNode();
           
           
            //first create the file specification, which holds the embedded file
            PDComplexFileSpecification fs = new PDComplexFileSpecification();
            fs.setFile( "Test.txt" );
            //create a dummy file stream, this would probably normally be a FileInputStream
            byte[] data = "This is the contents of the embedded file".getBytes();
            ByteArrayInputStream fakeFile =
                new ByteArrayInputStream( data );
            PDEmbeddedFile ef = new PDEmbeddedFile(doc, fakeFile );
            //now lets some of the optional parameters
            ef.setSubtype( "test/plain" );
            ef.setSize( data.length );
            ef.setCreationDate( new GregorianCalendar() );
            fs.setEmbeddedFile( ef );
           
            //now add the entry to the embedded file tree and set in the document.
            Map efMap = new HashMap();
            efMap.put( "My first attachment", fs );
            efTree.setNames( efMap );
View Full Code Here

TOP

Related Classes of org.pdfbox.pdmodel.common.filespecification.PDComplexFileSpecification

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.