瘋狂

          STANDING ON THE SHOULDERS OF GIANTS
          posts - 481, comments - 486, trackbacks - 0, articles - 1
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          使用apache pdfbox讀取pdf 實(shí)例

          Posted on 2011-02-24 14:55 瘋狂 閱讀(2787) 評(píng)論(2)  編輯  收藏 所屬分類: java apache項(xiàng)目
          public static void main(String[] args) throws Exception {
              InputStream inputStream 
          = new BufferedInputStream(
                      
          new FileInputStream(new File("d:\\work\\lt.pdf")));
              PDDocument pdfDocument 
          = PDDocument.load(inputStream);
              StringWriter writer 
          = new StringWriter();
              PDFTextStripper stripper 
          = new PDFTextStripper();
              stripper.writeText(pdfDocument, writer);
              String contents 
          = writer.getBuffer().toString();
              System.out.println(
          "文檔內(nèi)容:"+contents);
              PDDocumentInformation documentInformation 
          = pdfDocument.getDocumentInformation();
              System.out.println(
          "標(biāo)題:"+documentInformation.getTitle());
          }

          }
          需要jar包:
          pdfbox-1.4.0.jar
          fontbox-1.4.0.jar

          評(píng)論

          # re: 使用apache pdfbox讀取pdf 實(shí)例[未登錄]  回復(fù)  更多評(píng)論   

          2011-04-21 05:16 by water
          利用本程序解決了我的問題。謝謝!
          主站蜘蛛池模板: 沛县| 西昌市| 周口市| 香河县| 治县。| 封丘县| 河源市| 黑龙江省| 屯昌县| 南安市| 广平县| 潜江市| 凤庆县| 繁峙县| 嵊泗县| 通山县| 竹山县| 新余市| 惠水县| 易门县| 屯昌县| 麻城市| 蓬莱市| 泰兴市| 山阴县| 普兰县| 陆川县| 白银市| 晋州市| 砚山县| 西乌珠穆沁旗| 肇源县| 赤水市| 五大连池市| 沈阳市| 神池县| 永定县| 丹江口市| 镇坪县| 唐山市| 抚顺县|