Package org.apache.pdfbox.pdmodel.common

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


        // This whole section of code needs to be replaced with an actual type1 font parser!!
        // Get the font program from the embedded type font.
        PDFontDescriptor fontDescriptor = getFontDescriptor();
        if( fontDescriptor != null && fontDescriptor instanceof PDFontDescriptorDictionary)
        {
            PDStream fontFile = ((PDFontDescriptorDictionary)fontDescriptor).getFontFile();
            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


        // read the pfb
        PfbParser pfbparser = new PfbParser(pfb);
        pfb.close();

        PDStream fontStream = new PDStream(doc, pfbparser.getInputStream(), false);
        fontStream.getStream().setInt("Length", pfbparser.size());
        for (int i = 0; i < pfbparser.getLengths().length; i++)
        {
            fontStream.getStream().setInt("Length" + (i + 1), pfbparser.getLengths()[i]);
        }
        fontStream.addCompression();
        fd.setFontFile(fontStream);

        // read the afm
        AFMParser parser = new AFMParser(afm);
        parser.parse();
View Full Code Here

     *
     * @param xobj The XObject dictionary.
     */
    public PDXObject(COSStream xobj)
    {
        xobject = new PDStream(xobj);
        getCOSStream().setItem(COSName.TYPE, COSName.XOBJECT);
    }
View Full Code Here

     *
     * @param doc The doc to store the object contents.
     */
    public PDXObject(PDDocument doc)
    {
        xobject = new PDStream(doc);
        getCOSStream().setItem(COSName.TYPE, COSName.XOBJECT);
    }
View Full Code Here

            COSStream xstream = (COSStream) xobject;
            String subtype = xstream.getNameAsString(COSName.SUBTYPE);
            // according to the PDF Reference : a thumbnail subtype must be Image if it is not null
            if (PDXObjectImage.SUB_TYPE.equals(subtype) || (subtype == null && isThumb))
            {
                PDStream image = new PDStream(xstream);
                // See if filters are DCT or JPX otherwise treat as Bitmap-like
                // There might be a problem with several filters, but that's ToDo until
                // I find an example
                List<COSName> filters = image.getFilters();
                if (filters != null && filters.contains(COSName.DCT_DECODE))
                {
                    return new PDJpeg(image);
                }
                else if (filters != null && filters.contains(COSName.CCITTFAX_DECODE))
View Full Code Here

   
    public PDOutputIntent(PDDocument doc, InputStream colorProfile) throws Exception{
        dictionary = new COSDictionary();
        dictionary.setItem(COSName.TYPE, COSName.OUTPUT_INTENT);
        dictionary.setItem(COSName.S, COSName.GTS_PDFA1);
        PDStream destOutputIntent = configureOutputProfile(doc, colorProfile);
        dictionary.setItem(COSName.DEST_OUTPUT_PROFILE, destOutputIntent);
    }
View Full Code Here

    {
        dictionary.setString(COSName.REGISTRY_NAME, value);
    }
   
    private PDStream configureOutputProfile (PDDocument doc, InputStream colorProfile) throws IOException {
        PDStream stream = new PDStream(doc,colorProfile, false);
        stream.getStream().setFilters(COSName.FLATE_DECODE);
        stream.getStream().setInt( COSName.LENGTH, stream.getByteArray().length );
        stream.getStream().setInt(COSName.N, 3);
        stream.addCompression();
        return stream;
    }
View Full Code Here

     */
    public PDFunction( COSBase function )
    {
        if (function instanceof COSStream)
        {
            functionStream = new PDStream( (COSStream)function );
            functionStream.getStream().setItem( COSName.TYPE, COSName.FUNCTION );
        }
        else if (function instanceof COSDictionary)
        {
            functionDictionary = (COSDictionary)function;
View Full Code Here

            for( int i=0; i<cs.getNumComponents(); i++ )
            {
                ranges.add( new COSFloat( ics.getMinValue( i ) ) );
                ranges.add( new COSFloat( ics.getMaxValue( i ) ) );
            }
            PDStream iccData = pdCS.getPDStream();
            OutputStream output = null;
            try
            {
                output = iccData.createOutputStream();
                output.write( ics.getProfile().getData() );
            }
            finally
            {
                if( output != null )
View Full Code Here

     */
    public PDICCBased( PDDocument doc )
    {
        array = new COSArray();
        array.add( COSName.ICCBASED );
        array.add( new PDStream( doc ) );
    }
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.