Package org.jpedal.objects.raw

Examples of org.jpedal.objects.raw.PdfObject


        int layers = layer.length;

        String ref,name,layerName=null;

        PdfObject nextObject;

        for(int ii=0;ii< layers;ii++){

            if(layer[ii] instanceof String){
                //ignore
            }else if(layer[ii] instanceof byte[]){

                byte[] rawRef=(byte[])layer[ii];
                ref =new String(rawRef);
                name=(String) refToPropertyID.get(ref);

                nextObject=(PdfObject)propertyMap.get(ref);

                if(nextObject==null){

                    if(rawRef!=null && rawRef[rawRef.length-1]=='R'){
                        nextObject=new OCObject(ref);
                        currentPdfFile.readObject(nextObject);
                        name=ref;
                    }else{ //it is a name for the level so add into path of name

                        if(parentName==null)
                            parentName=ref;
                        else
                          parentName=ref+deliminator+parentName;
                    }
                }

                if(nextObject!=null){

                    layerCount++;

                    layerName=nextObject.getTextStreamValue(PdfDictionary.Name);

                    if(parentName!=null)
                    layerName=layerName+deliminator+parentName;
                   
                    if(debug)
View Full Code Here


        int layers = layer.length;

        String ref,name;

        PdfObject nextObject;

        for (byte[] aLayer : layer) {

            ref = new String(aLayer);
            name = (String) refToPropertyID.get(ref);
            nextObject = (PdfObject) propertyMap.get(ref);

            if (nextObject != null) {

                layerCount++;

                String layerName = nextObject.getTextStreamValue(PdfDictionary.Name);

                if (parentName != null)
                    layerName = layerName + deliminator + parentName;

                //pick up full name set by Order
View Full Code Here

        String ref, name,layerName;

        byte[][] OCGs;

        PdfObject nextObject;

        for (byte[] A : AS) {

            //can also be a direct command which is not yet implemented
            if (A == null) {
                continue;
            }

            ref = new String(A);

            nextObject = new OCObject(ref);
            if (A[0] == '<')
                nextObject.setStatus(PdfObject.UNDECODED_DIRECT);
            else
                nextObject.setStatus(PdfObject.UNDECODED_REF);

            //must be done AFTER setStatus()
            nextObject.setUnresolvedData(A, PdfDictionary.AS);
            currentPdfFile.checkResolved(nextObject);

            event = nextObject.getParameterConstant(PdfDictionary.Event);
            if (nextObject != null) {

                if (event == PdfDictionary.View) {
                    OCGs = nextObject.getKeyArray(PdfDictionary.OCGs);

                    if (OCGs != null) {

                        int childCount = OCGs.length;
                        for (byte[] OCG : OCGs) {

                            ref = new String(OCG);
                            nextObject = new OCObject(ref);
                            if (OCG[0] == '<') {
                                nextObject.setStatus(PdfObject.UNDECODED_DIRECT);
                            } else
                                nextObject.setStatus(PdfObject.UNDECODED_REF);

                            //must be done AFTER setStatus()
                            nextObject.setUnresolvedData(OCG, PdfDictionary.OCGs);
                            currentPdfFile.checkResolved(nextObject);

                            layerName = nextObject.getTextStreamValue(PdfDictionary.Name);
                            name = (String) refToPropertyID.get(ref);

                            streamToName.put(name, layerName);

                            //System.out.println((char)OCGs[jj][0]+" "+ref+" "+" "+nextObject+" "+nextObject.getTextStreamValue(PdfDictionary.Name));

                            PdfObject usageObj = nextObject.getDictionary(PdfDictionary.Usage);

                            if (usageObj != null) {
                                PdfObject zoomObj = usageObj.getDictionary(PdfDictionary.Zoom);

                                //set zoom values
                                if (zoomObj != null) {
                                    float min = zoomObj.getFloatNumber(PdfDictionary.min);
                                    if (min != 0) {
                                        minScale.put(layerName, min);
                                    }
                                    float max = zoomObj.getFloatNumber(PdfDictionary.max);

                                    if (max != 0) {
                                        maxScale.put(layerName, max);
                                    }
                                }
View Full Code Here

        for (byte[] aLayer : layer) {

            String nextValue = new String(aLayer);

            PdfObject nextObject = new OCObject(nextValue);

            currentPdfFile.readObject(nextObject);

            String layerName = nextObject.getTextStreamValue(PdfDictionary.Name);

            layerLocks.put(layerName, "x");

        }
    }
View Full Code Here

        //see if visible
        boolean isVisible = true;

        //if layer object attached see if should be visible
        PdfObject layerObj = XObject.getDictionary(PdfDictionary.OC);

        if (layerObj != null) {

            String layerName=null;
            byte[][] OCGS = layerObj.getKeyArray(PdfDictionary.OCGs);

            if(OCGS!=null){
                for (byte[] OCG : OCGS) {
                    String ref = new String(OCGS[0]);
                    layerName = getNameFromRef(ref);
                }
            }

            if(layerName==null)
                layerName = layerObj.getTextStreamValue(PdfDictionary.Name);

            if (layerName != null  && isLayerName(layerName)) {
                isVisible = isVisible(layerName);
            }
        }
View Full Code Here

                    while(signatureObjects.hasNext()){

                        FormObject formObj = (FormObject) signatureObjects.next();

                        PdfObject sigObject=formObj.getDictionary(PdfDictionary.V);

                        decode_pdf.getIO().checkResolved(formObj);

                        if(sigObject == null){

                            if(!blank.isNodeChild(root))
                                root.add(blank);

                            DefaultMutableTreeNode blankNode = new DefaultMutableTreeNode(formObj.getTextStreamValue(PdfDictionary.T)+ " on page " + formObj.getPageNumber());
                            blank.add(blankNode);

                        } else {

                            if(!signed.isNodeChild(root))
                                root.add(signed);

                            //String name = (String) OLDsigObject.get("Name");

                            String name=sigObject.getTextStreamValue(PdfDictionary.Name);

                            DefaultMutableTreeNode owner = new DefaultMutableTreeNode("Signed by " + name);
                            signed.add(owner);

                            DefaultMutableTreeNode type = new DefaultMutableTreeNode("Type");
                            owner.add(type);

                            String filter = null;//sigObject.getName(PdfDictionary.Filter);

                            //@simon -new version to test
                            PdfArrayIterator filters = sigObject.getMixedArray(PdfDictionary.Filter);
                            if(filters!=null && filters.hasMoreTokens())
                                filter=filters.getNextValueAsString(true);

                            DefaultMutableTreeNode filterNode = new DefaultMutableTreeNode("Filter: " + filter);
                            type.add(filterNode);

                            String subFilter = sigObject.getName(PdfDictionary.SubFilter);

                            DefaultMutableTreeNode subFilterNode = new DefaultMutableTreeNode("Sub Filter: " + subFilter);
                            type.add(subFilterNode);

                            DefaultMutableTreeNode details = new DefaultMutableTreeNode("Details");
                            owner.add(details);


                            //@simon - guess on my part....
                            String rawDate=sigObject.getTextStreamValue(PdfDictionary.M);
                            //if(rawDate!=null){

                                StringBuilder date = new StringBuilder(rawDate);

                                date.delete(0, 2);
                                date.insert(4, '/');
                                date.insert(7, '/');
                                date.insert(10, ' ');
                                date.insert(13, ':');
                                date.insert(16, ':');
                                date.insert(19, ' ');

                                DefaultMutableTreeNode time = new DefaultMutableTreeNode("Time: " +date);
                                details.add(time);
                            //}

                            String reason=sigObject.getTextStreamValue(PdfDictionary.Reason);

                            DefaultMutableTreeNode reasonNode = new DefaultMutableTreeNode("Reason: " + reason);
                            details.add(reasonNode);

                            String location=sigObject.getTextStreamValue(PdfDictionary.Location);

                            DefaultMutableTreeNode locationNode = new DefaultMutableTreeNode("Location: " + location);
                            details.add(locationNode);

                            DefaultMutableTreeNode field = new DefaultMutableTreeNode("Field: " + formObj.getTextStreamValue(PdfDictionary.T)+ " on page " + formObj.getPageNumber());
View Full Code Here

      if(titleMessage==null)
        finalMessage=(windowTitle+' ' + commonValues.getSelectedFile());
      else
        finalMessage=titleMessage+ commonValues.getSelectedFile();

            PdfObject linearObj=(PdfObject)decode_pdf.getJPedalObject(PdfDictionary.Linearized);
            if(linearObj!=null){
                LinearThread linearizedBackgroundReaderer = (LinearThread) decode_pdf.getJPedalObject(PdfDictionary.LinearizedReader);

                if(linearizedBackgroundReaderer !=null && linearizedBackgroundReaderer.isAlive())
                    finalMessage=finalMessage+" (still loading)";
View Full Code Here

                   
          //String page = tree.getPageViaNodeNumber(index);
          String ref = tree.convertNodeIDToRef(index);

                    PdfObject Aobj=decode_pdf.getOutlineData().getAobj(ref);

                    //handle in our handler code
                    if(Aobj!=null){
                        /*int pageToDisplay=*/decode_pdf.getFormRenderer().getActionHandler().gotoDest(Aobj, ActionHandler.MOUSECLICKED, PdfDictionary.Dest );

View Full Code Here

        if(isFontSubstituted && glyphs.remapFont)
          glyphs.remapFont=false;

      }else if(pdfFontDescriptor!=null){
   
        PdfObject FontFile=pdfFontDescriptor.getDictionary(PdfDictionary.FontFile);
   
        /** try type 1 first then type 1c/0c */
        if (FontFile != null) {
          try {
            byte[] stream=currentPdfFile.readStream(FontFile,true,true,false, false,false, FontFile.getCacheName(currentPdfFile.getObjectReader()));
            if(stream!=null)
              readType1FontFile(stream);
          } catch (Exception e) {
            e.printStackTrace();
          }
        }else{
   
          PdfObject FontFile3=pdfFontDescriptor.getDictionary(PdfDictionary.FontFile3);
          if(FontFile3!=null){
            byte[] stream=currentPdfFile.readStream(FontFile3,true,true,false, false,false, FontFile3.getCacheName(currentPdfFile.getObjectReader()));
            if(stream!=null){ //if it fails, null returned
              //check for type1c or ottf
              if(stream.length>3 && stream[0]==719 && stream[1]==84 && stream[2]==84 && stream[3]==79){
              }else //assume all standard cff for moment
                readType1CFontFile(stream,null);
View Full Code Here

      init(fontID, renderPage);
     
      /**
       * get FontDescriptor object - if present contains metrics on glyphs
       */
      PdfObject pdfFontDescriptor=pdfObject.getDictionary(PdfDictionary.FontDescriptor);
     
      //FontBBox and FontMatix
      setBoundsAndMatrix(pdfFontDescriptor);
     
      setName(pdfObject, fontID);
View Full Code Here

TOP

Related Classes of org.jpedal.objects.raw.PdfObject

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.