Package com.sun.pdfview

Examples of com.sun.pdfview.PDFObject


    /** Creates a new instance of PDFDecoder */
    private PDFDecoder() {
    }

    public static boolean isLastFilter(PDFObject dict, Set<String> filters) throws IOException {
        PDFObject filter = dict.getDictRef("Filter");
        if (filter == null) {
            return false;
        } else if (filter.getType() == PDFObject.NAME) {
            return filters.contains(filter.getStringValue());
        } else {
            final PDFObject[] ary = filter.getArray();
            return filters.contains(ary[ary.length - 1].getStringValue());
        }
    }
View Full Code Here


     * @param streamBuf the data in the stream, as a byte buffer
     */
    public static ByteBuffer decodeStream(PDFObject dict, ByteBuffer streamBuf, Set<String> filterLimits)
            throws IOException {

        PDFObject filter = dict.getDictRef("Filter");
        if (filter == null) {
            // just apply default decryption
            return dict.getDecrypter().decryptBuffer(null, dict, streamBuf);
        } else {
            // apply filters
View Full Code Here

     * @throws IOException if there's a problem reading the objects
     */
    private static String getCryptFilterName(PDFObject param) throws IOException {
        String cfName = PDFDecrypterFactory.CF_IDENTITY;
        if (param != null) {
            final PDFObject nameObj = param.getDictRef("Name");
            if (nameObj != null && nameObj.getType() == PDFObject.NAME) {
                cfName = nameObj.getStringValue();
            }
        }
        return cfName;
    }
View Full Code Here

     * @throws IOException if the stream dictionary can't be read
     */
    public static boolean isEncrypted(PDFObject dict)
            throws IOException {

        PDFObject filter = dict.getDictRef("Filter");
        if (filter == null) {
            // just apply default decryption
            return dict.getDecrypter().isEncryptionPresent();
        } else {

View Full Code Here

                ary[0] = filter;
                params = new PDFObject[1];
                params[0] = dict.getDictRef("DecodeParms");
            } else {
                ary = filter.getArray();
                PDFObject parmsobj = dict.getDictRef("DecodeParms");
                if (parmsobj != null) {
                    params = parmsobj.getArray();
                } else {
                    params = new PDFObject[ary.length];
                }
            }
        }
View Full Code Here

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

     */
    public static PDFAction getAction(PDFObject obj, PDFObject root)
        throws IOException
    {
        // figure out the action type
        PDFObject typeObj = obj.getDictRef("S");
        if (typeObj == null) {
            throw new PDFParseException("No action type in object: " + obj);
        }
       
        // create the action based on the type
        PDFAction action = null;
        String type = typeObj.getStringValue();
        if (type.equals("GoTo")) {
            action = new GoToAction(obj, root);
        } else {
            /** [JK FIXME: Implement other action types! ] */
            throw new PDFParseException("Unknown Action type: " + type);
        }
       
        // figure out if there is a next action
        PDFObject nextObj = obj.getDictRef("Next");
        if (nextObj != null) {
            action.setNext(nextObj);
        }
       
        // return the action
View Full Code Here

     */
    public Type1CFont (String baseFont, PDFObject src,
                       PDFFontDescriptor descriptor) throws IOException {
        super (baseFont, src, descriptor);

        PDFObject dataObj = descriptor.getFontFile3 ();
        data = dataObj.getStream ();
        pos = 0;
        parse ();

        // TODO: free up (set to null) unused structures (data, subrs, stack)
    }
View Full Code Here

  // obj is a dictionary that has the following parts:
  // WhitePoint [a b c]
  // BlackPoint [a b c]
  // Gamma a
  super(TYPE_GRAY, 1);
  PDFObject ary= obj.getDictRef("WhitePoint");
  if (ary!=null) {
      for(int i=0; i<3; i++) {
    white[i]= ary.getAt(i).getFloatValue();
      }
  }
  ary= obj.getDictRef("BlackPoint");
  if (ary!=null) {
      for(int i=0; i<3; i++) {
    black[i]= ary.getAt(i).getFloatValue();
      }
  }
  PDFObject g= obj.getDictRef("Gamma");
  if (g!=null) {
      gamma= g.getFloatValue();
  }
    }
View Full Code Here

     */
    public static PDFColorSpace getColorSpace(PDFObject csobj, Map resources)
        throws IOException {
        String name;

        PDFObject colorSpaces = null;

        if (resources != null) {
            colorSpaces = (PDFObject) resources.get("ColorSpace");
        }

        if (csobj.getType() == PDFObject.NAME) {
            name = csobj.getStringValue();

            if (name.equals("DeviceGray") || name.equals("G")) {
                return getColorSpace(COLORSPACE_GRAY);
            } else if (name.equals("DeviceRGB") || name.equals("RGB")) {
                return getColorSpace(COLORSPACE_RGB);
            } else if (name.equals("DeviceCMYK") || name.equals("CMYK")) {
                return getColorSpace(COLORSPACE_CMYK);
            } else if (name.equals("Pattern")) {
                return getColorSpace(COLORSPACE_PATTERN);
            } else if (colorSpaces != null) {
                csobj = (PDFObject) colorSpaces.getDictRef(name);
            }
        }

        if (csobj == null) {
            return null;
View Full Code Here

TOP

Related Classes of com.sun.pdfview.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.