Package org.apache.pdfbox.pdmodel.common

Examples of org.apache.pdfbox.pdmodel.common.PDStream


    }

    public void createInnerFormStream(PDDocument template)
    {
        PDStream innterFormStream = new PDStream(template);
        pdfStructure.setInnterFormStream(innterFormStream);
        logger.info("Strean of another form (inner form - it would be inside holder form) has been created");
    }
View Full Code Here


        logger.info("Alerady inserted inner form  inside holder form");
    }

    public void createImageFormStream(PDDocument template)
    {
        PDStream imageFormStream = new PDStream(template);
        pdfStructure.setImageFormStream(imageFormStream);
        logger.info("Created image form Stream");

    }
View Full Code Here

     * @return a PDTrueTypeFont instance.
     * @throws IOException If there is an error loading the data.
     */
    public static PDTrueTypeFont loadTTF( PDDocument doc, InputStream stream, Encoding enc ) throws IOException
    {
        PDStream fontStream = new PDStream(doc, stream, false );
        fontStream.getStream().setInt( COSName.LENGTH1, fontStream.getByteArray().length );
        fontStream.addCompression();
        //only support winansi encoding right now, should really
        //just use Identity-H with unicode mapping
        return PDTrueTypeFont.loadTTF(fontStream,enc);
    }
View Full Code Here

    public Font getawtFont() throws IOException
    {
         PDFontDescriptorDictionary fd = (PDFontDescriptorDictionary)getFontDescriptor();
        if( awtFont == null )
        {
            PDStream ff2Stream = fd.getFontFile2();
            if( ff2Stream != null )
            {
                try
                {
                    // create a font with the embedded data
                    awtFont = Font.createFont( Font.TRUETYPE_FONT, ff2Stream.createInputStream() );
                }
                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

     */
    public Font getawtFont() throws IOException
    {
        Font awtFont = null;
        PDFontDescriptorDictionary fd = (PDFontDescriptorDictionary)getFontDescriptor();
        PDStream ff2Stream = fd.getFontFile2();
        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

     * @throws IOException If there is an error reading the tiff data.
     */

    public PDCcitt(PDDocument doc, RandomAccess raf) throws IOException
    {
        super(new PDStream(doc), "tiff");

        COSDictionary decodeParms = new COSDictionary();

        COSDictionary dic = getCOSStream();

View Full Code Here

    }

    @Override
    public PDStream extractFontFile(PDFontDescriptorDictionary fontDescriptor)
    {
        PDStream ff3 = fontDescriptor.getFontFile3();
        if (ff3 != null)
        {
            /*
             * Stream validation should be done by the StreamValidateHelper. Process font specific check
             */
            COSStream stream = ff3.getStream();
            if (stream == null)
            {
                this.fContainer.push(new ValidationError(ERROR_FONTS_FONT_FILEX_INVALID, "The FontFile is missing for "
                        + fontDescriptor.getFontName()));
                this.fContainer.notEmbedded();
View Full Code Here

    }

    @Override
    public PDStream extractFontFile(PDFontDescriptorDictionary fontDescriptor)
    {
        PDStream ff1 = fontDescriptor.getFontFile();
        PDStream ff3 = fontDescriptor.getFontFile3();

        if (ff1 != null)
        {
            COSStream stream = ff1.getStream();
            if (stream == null)
View Full Code Here

        COSStream destMetadata = (COSStream) destCatalog.getCOSDictionary().getDictionaryObject(COSName.METADATA);
        COSStream srcMetadata = (COSStream) srcCatalog.getCOSDictionary().getDictionaryObject(COSName.METADATA);
        if (destMetadata == null && srcMetadata != null)
        {
            PDStream newStream = new PDStream(destination, srcMetadata.getUnfilteredStream(), false);
            newStream.getStream().mergeInto(srcMetadata);
            newStream.addCompression();
            destCatalog.getCOSDictionary().setItem(COSName.METADATA, newStream);
        }

        // merge logical structure hierarchy if logical structure information is available in both source pdf and
        // destination pdf
View Full Code Here

                        name = getUniqueFileName( prefix, "ttf" );
                    }
                    PDFontDescriptorDictionary fd = (PDFontDescriptorDictionary)font.getFontDescriptor();
                    if (fd != null)
                    {
                        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

TOP

Related Classes of org.apache.pdfbox.pdmodel.common.PDStream

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.