Package com.sun.pdfview

Examples of com.sun.pdfview.PDFParseException


                    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


        } else if (subType.equals("CIDFontType0")) {
            font = new CIDFontType2(baseFont, obj, descriptor);
//            font = new CIDFontType0(baseFont, obj, descriptor);
//            throw new IOException ("CIDFontType0 is unimplemented. " + obj);
        } else {
            throw new PDFParseException("Don't know how to handle a '" +
                    subType + "' font");
        }

        font.setSubtype(subType);
        font.setEncoding(encoding);
View Full Code Here

            while (!inf.finished()) {
                read = inf.inflate(decomp);
                if (read <= 0) {
//        System.out.println("Read = " + read + "! Params: " + params);
                    if (inf.needsDictionary()) {
                        throw new PDFParseException("Don't know how to ask for a dictionary in FlateDecode");
                    } else {
//      System.out.println("Inflate data length=" + buf.remaining());
                        return ByteBuffer.allocate(0);
                    //      throw new PDFParseException("Inflater wants more data... but it's already here!");
                    }
                }
                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

        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        while (true) {
            int pW = cW;
            cW = nextCode();
            if (cW == -1) {
                throw new PDFParseException("Missed the stop code in LZWDecode!");
            }
            if (cW == STOP) {
                break;
            } else if (cW == CLEARDICT) {
                resetDict();
View Full Code Here

                    streamBuf = CCITTFaxDecode.decode(dict, streamBuf, spec.params[i]);
                } else if (enctype.equals("Crypt")) {
                    String cfName = getCryptFilterName(spec.params[i]);
                    streamBuf = dict.getDecrypter().decryptBuffer(cfName, null, streamBuf);
                } else {
                    throw new PDFParseException("Unknown coding method:" + spec.ary[i].getStringValue());
                }
            }
        }

        return streamBuf;
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
        dest = PDFDestination.getDestination(destObj, root);
    }
View Full Code Here

        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) {
View Full Code Here

            five[i] = nextChar();
            if (five[i] == '~') {
                if (nextChar() == '>') {
                    break;
                } else {
                    throw new PDFParseException("Bad character in ASCII85Decode: not ~>");
                }
            } else if (five[i] >= '!' && five[i] <= 'u') {
                five[i] -= '!';
            } else if (five[i] == 'z') {
                if (i == 0) {
                    five[i] = 0;
                    i = 4;
                } else {
                    throw new PDFParseException("Inappropriate 'z' in ASCII85Decode");
                }
            } else {
                throw new PDFParseException("Bad character in ASCII85Decode: " + five[i] + " (" + (char) five[i] + ")");
            }
        }

        if (i > 0) {
            i -= 1;
View Full Code Here

            PDFColorSpace base = getColorSpace(ary[1], resources);

            return new PatternSpace(base);
        } else {
            throw new PDFParseException("Unknown color space: " + name +
                " with " + ary[1]);
        }

        csobj.setCache(value);
View Full Code Here

            case 14:
            case 15:
                predictor = new PNGPredictor();
                break;
            default:
                throw new PDFParseException("Unknown predictor: " + algorithm);
        }
       
        // read the colors (optional)
        PDFObject colorsObj = params.getDictRef("Colors");
        if (colorsObj != null) {
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.