Package org.jpedal.objects.raw

Examples of org.jpedal.objects.raw.PdfObject


                                }
                               
                                if(bookmarkPage!=null){ //and goto named Dest if present

                                    //read the object
                                    PdfObject namedDest=new OutlineObject((String)bookmarkPage);
                                    decode_pdf.getIO().readObject(namedDest);

                                    //and generic open Dest code
                                    decode_pdf.getFormRenderer().getActionHandler().gotoDest(namedDest, ActionHandler.MOUSECLICKED, PdfDictionary.Dest );
                                }
View Full Code Here


                            if(inputStream!=null)
                                decode_pdf.openPdfFileFromInputStream(inputStream, true);
                            else
                                decode_pdf.openPdfFileFromURL(commonValues.getSelectedFile(), true);

                            PdfObject linearObj=(PdfObject) decode_pdf.getJPedalObject(PdfDictionary.Linearized);
                            int linearfileLength=linearObj.getInt(PdfDictionary.L);

                            String message="Downloading ";
                            linearfileLength=linearfileLength/1024;
                            if(linearfileLength<1024)
                                message=message+linearfileLength+" kB";
View Full Code Here

                            if(b_data==null){
                                isPageAvailable=false;
                            }else{
                                //check Resources
                                PdfObject Resources=linObject.getDictionary(PdfDictionary.Resources);

                                if(Resources==null){
                                    linObject=null;
                                    isPageAvailable=false;
                                }else if(!objDecoder.resolveFully(Resources)){
                                    linObject=null;
                                    isPageAvailable=false;
                                }else{
                                    Resources.isDataExternal(true);
                                    new PdfStreamDecoder(currentPdfFile).readResources(Resources,true);
                                    if(!Resources.isFullyResolved()){
                                        linObject=null;
                                        isPageAvailable=false;
                                    }
                                }
                            }
View Full Code Here

            System.out.println(padding+"before alt colorspace >>"+(char)raw[i]+(char)raw[i+1]+(char)raw[i+2]+(char)raw[i+3]);
            System.out.println("i="+i+"  >>"+(char)raw[i]+(char)raw[i+1]+(char)raw[i+2]+(char)raw[i+3]+(char)raw[i+4]+(char)raw[i+5]+(char)raw[i+6]+(char)raw[i+7]);
        }

        //read the alt colorspace
        PdfObject altColorSpace=new ColorSpaceObject(-1,0);
        i=handleColorSpaces(altColorSpace, i,  raw);
        pdfObject.setDictionary(PdfDictionary.AlternateSpace,altColorSpace);

        i++;

        //read the transform
        PdfObject tintTransform=new FunctionObject(-1,0);

        i=handleColorSpaces(tintTransform, i,  raw);
        pdfObject.setDictionary(PdfDictionary.tintTransform,tintTransform);

        //check for attributes
        for(int ii=i;ii<raw.length;ii++){

            if(raw[ii]==']'){
                break;
            }else if(raw[ii]==32 || raw[ii]==10 || raw[ii]==13){//ignore spaces
            }else{

                i=ii;
                //read the attributes
                PdfObject attributesObj=new ColorSpaceObject(-1,0);
                i=handleColorSpaces(attributesObj, i,  raw);
                pdfObject.setDictionary(PdfDictionary.Process,attributesObj);
                i--;
                ii=raw.length;
View Full Code Here

        return i;
    }

    private int readIndexedColorspace(PdfObject pdfObject, int i, byte[] raw) {
        //read the base value
        PdfObject IndexedColorSpace=new ColorSpaceObject(-1,0,true);

        //IndexedColorSpace.setRef(pdfObject.getObjectRefAsString());
        i=handleColorSpaces(IndexedColorSpace, i,  raw);
        pdfObject.setDictionary(PdfDictionary.Indexed,IndexedColorSpace);


        //onto hival number
        while(i<raw.length && (raw[i]==32 || raw[i]==13 || raw[i]==10 || raw[i]==']' || raw[i]=='>'))
            i++;

        if(debugColorspace)
            System.out.println(padding + "Indexed Reading hival starting at >>" + (char) raw[i] + (char) raw[i + 1]+(char)+raw[i+2]+"<<i="+i);

        //hival
        i = setNumberValue(pdfObject, i, raw, PdfDictionary.hival);

        if(debugColorspace)
            System.out.println("hival="+pdfObject.getInt(PdfDictionary.hival)+" i="+i+" raw[i]="+(char)raw[i]);

        if(raw[i]!='(')
            i++;

        if(debugColorspace)
            System.out.println(padding + "next chars >>" + (char) raw[i] + (char) raw[i + 1]+(char)+raw[i+2]+"<<i="+i);

        //onto lookup
        while(i<raw.length && (raw[i]==32 || raw[i]==13 || raw[i]==10))
            i++;

        if(debugColorspace)
            System.out.println(padding+"Indexed Reading lookup "+(char)raw[i]+(char)raw[i+1]+(char)raw[i+2]+(char)raw[i+3]+(char)raw[i+4]);

        //read lookup
        //get the colorspace data (base)

        PdfObject IndexedColorSpaceData;

        //can be embedded in this object (when we need to use ref or in separate object
        //when we need to use that ref). This code switches as needed)
        boolean needsKey=raw[i]=='[' || raw[i]=='(' || raw[i]=='<';
        if(needsKey)
View Full Code Here

        if(debugColorspace)
            System.out.println(padding+"Separation Reading altColorspace >>"+(char)raw[i]+(char)raw[i+1]);

        //read the alt colorspace
        PdfObject altColorSpace=new ColorSpaceObject(-1,0);
        i=handleColorSpaces(altColorSpace, i,  raw);
        pdfObject.setDictionary(PdfDictionary.AlternateSpace,altColorSpace);

        //allow for no gap
        if(raw[i]!='<')
            i++;

        //read the transform
        PdfObject tintTransform=new FunctionObject(-1,0);

        if(debugColorspace)
            System.out.println(padding + "Separation Reading tintTransform " + (char) raw[i - 1] + (char) raw[i]+(char)raw[i+1]+" into "+tintTransform);

        i=handleColorSpaces(tintTransform, i,  raw);
View Full Code Here


    int processColorSpace(PdfObject pdfObject, String objectRef, int i, byte[] raw) {
        //very specific type of object

        PdfObject ColorSpace = null;

        //read the base value (2 cases - Colorspace pairs or value in XObject
        if (!pdfObject.ignoreRecursion()) {

            if (pdfObject.getObjectType() == PdfDictionary.ColorSpace) {//pairs

                return handleColorSpaces(pdfObject, i, raw);

            }else{ //Direct object in XObject

                //can be called in 2 diff ways and this is difference
                boolean isKey=raw[i]=='/';
                if(isKey)
                    ColorSpace = new ColorSpaceObject(objectRef);
                else
                    ColorSpace = new ColorSpaceObject(-1,0);

                pdfObject.setDictionary(PdfDictionary.ColorSpace, ColorSpace);

                if(ColorSpace.isDataExternal()){
                    ColorSpace.isDataExternal(true);
                    if(!this.resolveFully(ColorSpace))
                        pdfObject.setFullyResolved(false);
                }

                return handleColorSpaces(ColorSpace, i, raw);
            }
        } else {//roll on and ignore

            pdfObject.setDictionary(PdfDictionary.ColorSpace, ColorSpace);

            if(ColorSpace.isDataExternal()){
                ColorSpace.isDataExternal(true);
                if(!resolveFully(ColorSpace))
                    pdfObject.setFullyResolved(false);
            }

            if (raw[i] == '<' && raw[i + 1] == '<') {
View Full Code Here

 
          if(formObj.isPopupBuilt()){
              popup = (JComponent)formObj.getPopupObj();
 
          }else {
              PdfObject popupObj=formObj.getDictionary(PdfDictionary.Popup);
              currentPdfFile.checkResolved(popupObj);
             
              if(popupObj==null){
                popupObj = new FormObject();
                ((FormObject)popupObj).copyInheritedValuesFromParent(formObj);
                ((FormObject)popupObj).setParent(formObj.getObjectRefAsString());
                //dont set the parent object as this is a copy of the same object
              }
             
          popup = new PdfSwingPopup(formObj,popupObj,pageData.getCropBoxWidth(currentPage));
         
          //copy current popup bounds array so we can add new bounds to new index
          float[][] tmpf = new float[popupBounds.length+1][4];
              System.arraycopy(popupBounds, 0, tmpf, 0, popupBounds.length);
             
              //get rectangle for new popup
              tmpf[popupBounds.length] = popupObj.getFloatArray(PdfDictionary.Rect);
              popupBounds = tmpf;
         
              //copy current popups array so we can add a new one to end
              JComponent[] tmp = new JComponent[popups.length+1];
              System.arraycopy(popups, 0, tmp, 0, popups.length);
             
              //add new popup to end of popup array
              tmp[popups.length] = popup;
              popups = tmp;
             
              formObj.setPopupBuilt(popup);
             
              //draw the popup on screen for the first time
              popup.setVisible(popupObj.getBoolean(PdfDictionary.Open));
             
              //rescale the components to that the popup bounds are scaled to the current display
              forceRedraw  = true;
          resetScaledLocation(displayScaling, rotation, indent);
          panel.repaint();
View Full Code Here

        if(showMethods)
            System.out.println("DefaultActionHandler.A() ");
           
           
            // new version
            PdfObject aData = null;
            if(eventType==MOUSERELEASED ){
                //get the A action if we have activated the form (released)
                aData = formObj.getDictionary(PdfDictionary.A);
            }
           
            if(aData==null){
                aData = formObj.getDictionary(PdfDictionary.AA);
                if(aData!=null){
                    if(eventType == MOUSEENTERED){
                        aData = aData.getDictionary(PdfDictionary.E);
                    }else if(eventType == MOUSEEXITED){
                        aData = aData.getDictionary(PdfDictionary.X);
                    }else if(eventType == MOUSEPRESSED){
                        aData = aData.getDictionary(PdfDictionary.D);
                    }else if(eventType == MOUSERELEASED){
                        aData = aData.getDictionary(PdfDictionary.U);
                    }
                }
            }
           
            //change cursor for each event
            actionFactory.setCursor(eventType);
           
            gotoDest(formObj,eventType,PdfDictionary.Dest);
           
            int subtype=formObj.getParameterConstant(PdfDictionary.Subtype);
           
            int popupFlag = formObj.getActionFlag();
           
            if (subtype == PdfDictionary.Sig) {
               
                additionalAction_Signature(formObj, eventType);
               
            } else if (eventType==MOUSECLICKED && (popupFlag == FormObject.POPUP || subtype==PdfDictionary.Text)){
                actionFactory.popup(raw,formObj,currentPdfFile);
            } else {
                // can get empty values
                if (aData == null)
                    return;
               
                int command = aData.getNameAsConstant(PdfDictionary.S);
               
                // S is Name of action
                if (command != PdfDictionary.Unknown) {
                   
                    if (command == PdfDictionary.Named) {
                       
                        additionalAction_Named(eventType, aData);
                       
                    }else if(command==PdfDictionary.Goto || command==PdfDictionary.GoToR){
                        if (aData != null) {
                            gotoDest(aData, eventType,command);
                        }
                    } else if (command == PdfDictionary.ResetForm) {
                       
                        additionalAction_ResetForm();
                       
                    } else if (command == PdfDictionary.SubmitForm) {
                       
                        additionalAction_SubmitForm(aData);
                       
                    } else if (command == PdfDictionary.JavaScript) {
                       
                        //javascript called above.
                       
                    } else if (command == PdfDictionary.Hide) {
                       
                        additionalAction_Hide(eventType, aData);
                       
                    } else if (command == PdfDictionary.URI) {
                       
                        additionalAction_URI(eventType, aData.getTextStreamValue(PdfDictionary.URI));
                       
                    } else if (command == PdfDictionary.Launch) {
                       
                        //<start-thin><start-adobe>
                        try {
                            //get the F dictionary
                            PdfObject dict=aData.getDictionary(PdfDictionary.F);
                           
                            //System.out.println("dict="+dict+" "+dict.getObjectRefAsString());
                           
                            //then get the submit URL to use
                            if(dict!=null){
                                String target = dict.getTextStreamValue(PdfDictionary.F);
                               
                                InputStream sourceFile = getClass().getResourceAsStream("/org/jpedal/res/"+target);
                               
                                if(sourceFile==null){
                                    JOptionPane.showMessageDialog(decode_pdf,"Unable to locate "+target);
View Full Code Here

    boolean newExcludeList=false;
    String newSubmitURL=null;
    String[] newListOfFields=null;
   
    //get the F dictionary
        PdfObject dict=aData.getDictionary(PdfDictionary.F);
        //then get the submit URL to use
        if(dict!=null)
    newSubmitURL = dict.getTextStreamValue(PdfDictionary.F);
       
    //get the fields we need to change
    PdfArrayIterator fieldList = aData.getMixedArray(PdfDictionary.Fields);
    if (fieldList != null) {
      if (fieldList.getTokenCount() < 1)
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.