Package com.sun.pdfview

Examples of com.sun.pdfview.PDFParseException


        // correct user password. The key obtained in step 1 (that is, in the
        // first step of Algorithm 3.4 or 3.5) can be used to decrypt the
        // document using Algorithm 3.1 on page 119.
        assert calculatedUValue.length == 32;
        if (uValue.length != calculatedUValue.length) {
            throw new PDFParseException("Improper U entry length; " +
                    "expected 32, is " + uValue.length);
        }
        // Only the first 16 bytes are significant if using revision > 2
        final int numSignificantBytes = revision == 2 ? 32 : 16;
        for (int i = 0; i < numSignificantBytes; ++i) {
View Full Code Here


        this.decrypters = decrypters;
        assert this.decrypters.containsKey("Identity") :
                "Crypt Filter map does not contain required Identity filter";
        defaultStreamDecrypter = this.decrypters.get(defaultStreamCryptName);
        if (defaultStreamDecrypter == null) {
            throw new PDFParseException(
                    "Unknown crypt filter specified as default for streams: " +
                            defaultStreamCryptName);
        }
        defaultStringDecrypter = this.decrypters.get(defaultStringCryptName);
        if (defaultStringDecrypter == null) {
            throw new PDFParseException(
                    "Unknown crypt filter specified as default for strings: " +
                            defaultStringCryptName);
        }
    }
View Full Code Here

        if (cryptFilterName == null) {
            decrypter = defaultStreamDecrypter;
        } else {
            decrypter = decrypters.get(cryptFilterName);
            if (decrypter == null) {
                throw new PDFParseException("Unknown CryptFilter: " +
                        cryptFilterName);
            }
        }
        return decrypter.decryptBuffer(
                // elide the filter name to prevent V2 decrypters from
View Full Code Here

    // check if at least the file or one of the OS specific launch parameters is set:
    if ((this.file == null)
      && (this.winParam == null)
      && (this.unixParam == null)
      && (this.macParam == null)) {
      throw new PDFParseException("Could not parse launch action (file or OS " +
          "specific launch parameters are missing): " + obj.toString());
    }
  }
View Full Code Here

        file.setRelatedFile(fileObj.getDictRef("RF"));
        file.setCollectionItem(fileObj.getDictRef("CI"));
      }else if(fileObj.getType() == PDFObject.STRING){
        file.setFileName(fileObj.getStringValue());
      }else{
        throw new PDFParseException("File specification could not be parsed " +
          "(should be of type 'Dictionary' or 'String'): " + fileObj.toString());
      }
    }
    return file;
  }
View Full Code Here

                    c -= 'A' - 10;
                } else if (c == '>') {
                    c = -1;
                } else {
                    // unknown character
                    throw new PDFParseException("Bad character " + c +
                                                "in ASCIIHex decode");
                }
               
                // return the useful character
                return c;
            }
        }
       
        // end of stream reached
  throw new PDFParseException("Short stream in ASCIIHex decode");
    }
View Full Code Here

        // copy to buffered image
        bimg = new BufferedImage(imageIcon.getIconWidth(), imageIcon.getIconHeight(), BufferedImage.TYPE_INT_RGB);
        bimg.getGraphics().drawImage(img, 0, 0 , null);
      }     
    } catch (Exception ex) {
      PDFParseException ex2 = new PDFParseException("DCTDecode failed");
      ex2.initCause(ex);
      throw ex2;
    }

    return bimg;
  }
View Full Code Here

        try {         
            while (!inf.finished()) {
                read = inf.inflate(decomp);
                if (read <= 0) {
                    if (inf.needsDictionary()) {                     
                        throw new PDFParseException("Don't know how to ask for a dictionary in FlateDecode");
                    } else {
                         // just return the data which is already read
                         break;
                    }
                }
                baos.write(decomp, 0, read);
            }
        } catch (DataFormatException dfe) {
            throw new PDFParseException("Data format exception:" + dfe.getMessage());
        }

        // return the output as a byte buffer
        ByteBuffer outBytes = ByteBuffer.wrap(baos.toByteArray());
View Full Code Here

        super("GoTo");
       
        // find the destination
        PDFObject destObj = obj.getDictRef("D");
        if (destObj == null) {
            throw new PDFParseException("No destination in GoTo action " + obj);
        }
       
        // parse it
        this.dest = PDFDestination.getDestination(destObj, root);
    }
View Full Code Here

    PDFObject val = parent;
    while (val.getType() == PDFObject.DICTIONARY) {
      val = val.getDictRef(key);
      if(val == null){
        if(mandatory){
          throw new PDFParseException(key + "value could not be parsed : " + parent.toString())
        }
        return null;
      }
    }
    return val.getStringValue();
View Full Code Here

TOP

Related Classes of com.sun.pdfview.PDFParseException

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.