Package org.jpedal.objects.raw

Examples of org.jpedal.objects.raw.FormObject


     * see sortCompsDesending(Component[])
     * This Is Called from That Method ONLY
     */
    private static void siftCompsDesending(FormObject[] array, int left, int right) {
        int currentLeft;
        FormObject primaryTMP;
        int childL;

        //assign left to local
        currentLeft = left;
        //temp store of left item
View Full Code Here


                    DefaultMutableTreeNode blank = new DefaultMutableTreeNode("The following signature fields are not signed");

                    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());
                            details.add(field);
                        }
                    }
                    if(signaturesTree==null){
                        signaturesTree = new JTree();
View Full Code Here

                        //number of components - may be several child items
                        //int count = comp.length;

                        //take value or first if array to check for types (will be same if children)
                        FormObject formObj = null;

                        //extract list of actual PDF references to display and get FormObject
                        String PDFrefs = "PDF ref=";

                        JLabel ref = new JLabel();

                        //actual data read from PDF
                        Object[] rawFormData = formData.getRawForm(formName);
                        int objCount = rawFormData.length;
                        for (Object aRawFormData : rawFormData) {
                            formObj = (FormObject) aRawFormData;
                            PDFrefs = PDFrefs + ' ' + formObj.getObjectRefAsString();
                        }

                        ref.setText(PDFrefs);

                        /** display the form component description */
                        // int formComponentType = ((Integer) formData.getTypeValueByName(formName)).intValue();

                        String formDescription = formName;
                        JLabel header = new JLabel(formDescription);

                        JLabel type = new JLabel();
                        type.setText("Type=" +
                                PdfDictionary.showAsConstant(formObj.getParameterConstant(PdfDictionary.Type)) +
                                " Subtype=" + PdfDictionary.showAsConstant(formObj.getParameterConstant(PdfDictionary.Subtype)));


                        /** get the current Swing component type */
                        String standardDetails = "java class=" + comp[0].getClass();

View Full Code Here

    //look for a match
    if(objs!=null){

      //new code to check for match
      Iterator objKeys=objs.keySet().iterator();
      FormObject annotObj=null;
      while(objKeys.hasNext()){
        annotObj=(FormObject) objKeys.next();
        if(annotObj.getBoundingRectangle().contains(x,y)){
          break;
        }

        //reset to null so when exits no match
        annotObj=null;
      }

      /**action for moved over of clicked*/
      if(annotObj!=null){

        /**
         * get EF object containing file data
         */
        //annotObj is now actual object (on lazy initialisation so EF has not been read).....

        System.out.println(mouseClicked+" obj="+annotObj+ ' ' +annotObj.getObjectRefAsString()+ ' ' +annotObj.getBoundingRectangle());

        //@annot - in my example, ignore if not clicked
        if(!mouseClicked)
          return;

        //FS obj contains an EF obj which contains an F obj with the data in
        //F can be various - we are only interested in it as a Dictionary with a stream
        PdfObject EFobj=null, FSobj=annotObj.getDictionary(PdfDictionary.FS);
        if(FSobj!=null)
          EFobj=FSobj.getDictionary(PdfDictionary.EF);

        /**
         * create the file chooser to select the file name
View Full Code Here

        Object[] rawObj=decode_pdf.getFormRenderer().getCompData().getRawForm(annotKey);

                for (Object aRawObj : rawObj) {
                    if (aRawObj != null) {
                        FormObject annotObj = (FormObject) aRawObj;


                        //get the FS value
                        //PdfObject FS=annotObj.getDictionary(PdfDictionary.FS);

                        //and the text
                        //                    if(FS!=null){
                        //                        System.out.println("----"+annotObj.getObjectRefAsString());
                        //                        System.out.println("Contents="+annotObj.getTextStreamValue(PdfDictionary.Contents));
                        //                        System.out.println("F="+FS.getTextStreamValue(PdfDictionary.F));
                        //                        System.out.println("D="+FS.getTextStreamValue(PdfDictionary.D));
                        //                    }

                        int subtype = annotObj.getParameterConstant(PdfDictionary.Subtype);

                        //                    if(subtype==PdfDictionary.Link){
                        //                        System.out.println("----"+annotObj.getObjectRefAsString());
                        //                        PdfObject Aobj=annotObj.getDictionary(PdfDictionary.A);
                        //                       System.out.println("A="+Aobj+" "+subtype);
                        //                        PdfObject winObj=Aobj.getDictionary(PdfDictionary.Win);
                        //                        System.out.println("Win="+winObj+" "+winObj.getTextStreamValue(PdfDictionary.D)+" "+winObj.getTextStreamValue(PdfDictionary.P));
                        //
                        //                    }
                        //subtypes set in PdfDictionary - please use Constant as values may change
                        //if not present ask me and I will add
                        if (subtype == PdfDictionary.FileAttachment) { //might also be PdfDictionary.Link

                            //@annot -save so we can lookup (kept as HashMap siply to reduce changes and in case
                            //we want something else as value. Could be Set or Vector
                            objs.put(annotObj, "x");

                            Color col = Color.BLUE;

                            //get origin of Form Object
                            Rectangle location = annotObj.getBoundingRectangle();

                            //SOME EXAMPLES to show other possible uses

                            //example stroked shape
                            //                  type[i]= org.jpedal.render.DynamicVectorRenderer.STROKEDSHAPE;
View Full Code Here

        PdfDecoder decodePdf = pdfDecoder;
        Map i = decodePdf.getFormRenderer().getCompData().getRawFormData();
        Set keys = i.keySet();
        allFormObjectPositions = new HashMap<Long, Vector<FormObject>>();
        for (Object key : keys) {
            FormObject frmOb = (FormObject) i.get(key);
            SrcPosition srcpos = new SrcPosition(frmOb);
            if (srcpos.valid) {
                try {
                    long position = srcpos.line * 10000 + srcpos.from;
                    Vector<FormObject> frms = new Vector<FormObject>();
View Full Code Here

TOP

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

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.