瘋狂

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

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

          Posted on 2011-02-24 14:55 瘋狂 閱讀(2792) 評(píng)論(2)  編輯  收藏 所屬分類(lèi): 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í)例[未登錄](méi)  回復(fù)  更多評(píng)論   

          2011-04-21 05:16 by water
          利用本程序解決了我的問(wèn)題。謝謝!
          主站蜘蛛池模板: 南华县| 高雄县| 南木林县| 民丰县| 宝丰县| 当雄县| 新绛县| 石台县| 怀来县| 上饶县| 措勤县| 东台市| 呈贡县| 新宾| 高要市| 江川县| 那坡县| 平山县| 土默特右旗| 宁明县| 延长县| 景宁| 遵义县| 静乐县| 木里| 侯马市| 涪陵区| 南溪县| 台东县| 沂水县| 休宁县| 沈阳市| 保康县| 平舆县| 庄河市| 宣恩县| 大渡口区| 吉木乃县| 佛坪县| 巴青县| 松桃|