Package org.apache.pdfbox.pdmodel.common

Examples of org.apache.pdfbox.pdmodel.common.PDStream.createInputStream()


        if( ff2Stream != null )
        {
            try
            {
                // create a font with the embedded data
                awtFont = Font.createFont( Font.TRUETYPE_FONT, ff2Stream.createInputStream() );
            }
            catch( FontFormatException f )
            {
                LOG.info("Can't read the embedded font " + fd.getFontName() );
            }
View Full Code Here


                        PDStream ff2Stream = fd.getFontFile2();
                        if (ff2Stream != null)
                        {
                            System.out.println( "Writing font:" + name );
                            FileOutputStream fos = new FileOutputStream(new File(name+".ttf"));
                            IOUtils.copy(ff2Stream.createInputStream(), fos);
                            fos.close();
                        }
                    }
                }
            }
View Full Code Here

            PDStream ff3Stream = ((PDFontDescriptorDictionary)fd).getFontFile3();
            if( ff3Stream != null )
            {
                ByteArrayOutputStream os = new ByteArrayOutputStream();

                InputStream is = ff3Stream.createInputStream();
                try
                {
                    byte[] buf = new byte[512];
                    while(true)
                    {
View Full Code Here

            if( fontFile != null )
            {
                BufferedReader in = null;
                try
                {
                    in = new BufferedReader(new InputStreamReader(fontFile.createInputStream()));
                   
                    // this section parses the font program stream searching for a /Encoding entry
                    // if it contains an array of values a Type1Encoding will be returned
                    // if it encoding contains an encoding name the corresponding Encoding will be returned
                    String line = "";
View Full Code Here

            if( ff2Stream != null )
            {
                try
                {
                    // create a font with the embedded data
                    awtFont = Font.createFont( Font.TRUETYPE_FONT, ff2Stream.createInputStream() );
                }
                catch( FontFormatException f )
                {
                    try
                    {
View Full Code Here

                catch( FontFormatException f )
                {
                    try
                    {
                        // as a workaround we try to rebuild the embedded subsfont
                        byte[] fontData = rebuildTTF(fd, ff2Stream.createInputStream());
                        if (fontData != null)
                        {
                            ByteArrayInputStream bais = new ByteArrayInputStream(fontData);
                            awtFont = Font.createFont( Font.TRUETYPE_FONT,bais);
                        }
View Full Code Here

            if( fontFile != null )
            {
                BufferedReader in = null;
                try
                {
                    in = new BufferedReader(new InputStreamReader(fontFile.createInputStream()));
                   
                    // this section parses the font program stream searching for a /Encoding entry
                    // if it contains an array of values a Type1Encoding will be returned
                    // if it encoding contains an encoding name the corresponding Encoding will be returned
                    String line = "";
View Full Code Here

            if( fontFile != null )
            {
                BufferedReader in = null;
                try
                {
                    in = new BufferedReader(new InputStreamReader(fontFile.createInputStream()));
                   
                    // this section parses the font program stream searching for a /Encoding entry
                    // if it contains an array of values a Type1Encoding will be returned
                    // if it encoding contains an encoding name the corresponding Encoding will be returned
                    String line = "";
View Full Code Here

            PDStream ff3Stream = ((PDFontDescriptorDictionary)fd).getFontFile3();
            if( ff3Stream != null )
            {
                ByteArrayOutputStream os = new ByteArrayOutputStream();

                InputStream is = ff3Stream.createInputStream();
                try
                {
                    byte[] buf = new byte[512];
                    while(true)
                    {
View Full Code Here

        PDStream fontStream = new PDStream(doc, stream, false );
        fontStream.getStream().setInt( COSName.LENGTH1, fontStream.getByteArray().length );
        fontStream.addCompression();
        fd.setFontFile2( fontStream );
        // As the stream was close within the PDStream constructor, we have to recreate it
        stream = fontStream.createInputStream();
        try
        {
            retval.loadDescriptorDictionary(fd, stream);
        }
        finally
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.