Package org.apache.pdfbox.pdfparser

Examples of org.apache.pdfbox.pdfparser.PDFParser


            PDDocument document = null;
            FileInputStream file = null;
            try
            {
                file = new FileInputStream( args[0] );
                PDFParser parser = new PDFParser( file );
                parser.parse();
                document = parser.getPDDocument();
                if( document.isEncrypted() )
                {
                    try
                    {
                        document.decrypt( "" );
View Full Code Here


    }

    private static PDDocument getDocument( String filename ) throws IOException
    {
        FileInputStream input = null;
        PDFParser parser = null;
        PDDocument result = null;
        try
        {
            input = new FileInputStream( filename );
            parser = new PDFParser( input );
            parser.parse();
            result = parser.getPDDocument();
        }
        finally
        {
            if( input != null )
            {
View Full Code Here

     *
     * @throws IOException If there is an error reading from the stream.
     */
    public static PDDocument load( InputStream input, RandomAccess scratchFile ) throws IOException
    {
        PDFParser parser = new PDFParser( new BufferedInputStream( input ), scratchFile );
        parser.parse();
        return parser.getPDDocument();
    }
View Full Code Here

     *
     * @throws IOException If there is an error reading from the stream.
     */
    public static PDDocument load(InputStream input, RandomAccess scratchFile, boolean force) throws IOException
    {
        PDFParser parser = new PDFParser( new BufferedInputStream( input ), scratchFile, force);
        parser.parse();
        return parser.getPDDocument();
    }
View Full Code Here

        java.io.OutputStream os = null;
        COSWriter writer = null;
        try
        {
            is = new java.io.FileInputStream(in);
            PDFParser parser = new PDFParser(is);
            parser.parse();

            COSDocument doc = parser.getDocument();

            os = new java.io.FileOutputStream(out);
            writer = new COSWriter(os);

            writer.write(doc);
View Full Code Here

     *
     * @throws IOException If there is an error reading from the stream.
     */
    public static FDFDocument load( InputStream input ) throws IOException
    {
        PDFParser parser = new PDFParser( input );
        parser.parse();
        return parser.getFDFDocument();
    }
View Full Code Here

    {
        COSDocument cos = null;

        try
        {
            PDFParser parser = new PDFParser(metadata);
            parser.parse();
            cos = parser.getDocument();

            // sanity check: PDFBox breaks on encrypted documents, so give up.
            if(cos.getEncryptionDictionary() != null)
            {
                throw new MetadataValidationException("This packager cannot accept an encrypted PDF document.");
View Full Code Here

      pdfStripper.setStartPage(1);
      pdfStripper.setEndPage(1);

      FileInputStream input = new FileInputStream(file);

      PDFParser parser = new PDFParser(input);
      parser.parse();
      cosDoc = parser.getDocument();
      pdDoc = new PDDocument(cosDoc);

      String text = pdfStripper.getText(pdDoc);
      text = text.replaceAll("\t", " ");
      Iterable<String> lines = Splitter.on("\n").split(text);
View Full Code Here

  public InputStream cut(final InputStream source, final int start, final int end) {
    try {
      Assert.notNull(source, "source");
      Assert.greaterOrEqual(start, 1, "start");

      PDFParser parser = new PDFParser(source);
      parser.parse();

      PDDocument document = parser.getPDDocument();

      Splitter splitter = new Splitter();
      splitter.setSplitAtPage(1);

      List<PDDocument> list = splitter.split(document);
View Full Code Here

  public InputStream[] split(final InputStream source, final int size) {
    try {
      Assert.notNull(source, "source");
      Assert.greaterThan(size, 0, "size");

      PDFParser parser = new PDFParser(source);
      parser.parse();

      PDDocument document = parser.getPDDocument();
      Splitter splitter = new Splitter();
      splitter.setSplitAtPage(size);

      List<PDDocument> list = splitter.split(document);
      InputStream[] array = new InputStream[list.size()];
View Full Code Here

TOP

Related Classes of org.apache.pdfbox.pdfparser.PDFParser

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.