Package org.jpedal.parser

Examples of org.jpedal.parser.T3StreamDecoder


        PdfObject CharProcs=pdfObject.getDictionary(PdfDictionary.CharProcs);

        //handle type 3 charProcs and store for later lookup
        if(CharProcs!=null){

            T3StreamDecoder glyphDecoder=new T3StreamDecoder(currentPdfFile,hires, isPrinting);
            glyphDecoder.setParameters(false,true,7,0);

            glyphDecoder.setObjectValue(ValueTypes.ObjectStore, objectStore);

            PdfObject Resources=pdfObject.getDictionary(PdfDictionary.Resources);
            if(Resources!=null){
                try {
                    glyphDecoder.readResources(Resources,false);
                } catch (PdfException e2) {
                    e2.printStackTrace();
                }
            }

            /**
             * read all the key pairs for Glyphs
             */
            PdfKeyPairsIterator keyPairs=CharProcs.getKeyPairsIterator();

            String glyphKey,pKey;
            PdfObject glyphObj;
           
            while(keyPairs.hasMorePairs()){

                glyphKey=keyPairs.getNextKeyAsString();               
                glyphObj=keyPairs.getNextValueAsDictionary();

                Object diffValue=null;
                if(diffLookup!=null){
                  pKey= StandardFonts.convertNumberToGlyph(glyphKey, containsHexNumbers, allNumbers);
                    diffValue=diffLookup.get(pKey);
                }

                //decode and store in array
                if(glyphObj!=null && renderPage){

                    //decode and create graphic of glyph
                    T3Renderer glyphDisplay=new T3Display(0,false,20,objectStore);

                    glyphDisplay.setHiResImageForDisplayMode(hires);
                    glyphDisplay.setType3Glyph(glyphKey);
                   
                    try{
                        glyphDecoder.setObjectValue(ValueTypes.DynamicVectorRenderer,glyphDisplay);
                        glyphDecoder.setDefaultColors(currentGraphicsState.getNonstrokeColor(),currentGraphicsState.getNonstrokeColor());
                        int  renderX,renderY;
                   

                        //if size is 1 we need to scale up so we can see
                        int factor=1;
                        double[] fontMatrix=pdfObject.getDoubleArray(PdfDictionary.FontMatrix);
                        if(fontMatrix!=null && fontMatrix[0]==1 && (fontMatrix[3]==1 || fontMatrix[3]==-1))
                        factor=10;
                       
                        GraphicsState gs=new GraphicsState(0,0);
                        gs.CTM = new float[][]{{factor,0,0},
                                {0,factor,0},{0,0,1}
                        };

                        T3Size t3 = glyphDecoder.decodePageContent(glyphObj, gs);


                        renderX=t3.x;
                        renderY=t3.y;

View Full Code Here

TOP

Related Classes of org.jpedal.parser.T3StreamDecoder

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.