2013-12-19 180 views
-1
try 
     {    
      PdfReader reader = new PdfReader(RESULT1); 
      PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(RESULT2)); 
      AcroFields form = stamper.getAcroFields(); 
      String name = form.getField("Text1");//Check Box 1 
      stamper.close(); 
      reader.close(); 

      FileInputStream file = new FileInputStream(new File("//Users//"+ usr +"//Desktop//TNA//input//FR-OPS-030 Master Training Plan_Rev4.xls")); 
      HSSFWorkbook workbook = new HSSFWorkbook(file); 
      HSSFSheet sheet = workbook.getSheet("Sheet1");// getSheetAt(0); 

      HSSFRow row = sheet.createRow((short) 0);  
      HSSFCellStyle style = workbook.createCellStyle(); 
      style.setFillForegroundColor(HSSFColor.DARK_BLUE.index); 
      style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); 

      HSSFRow row1 = sheet.createRow(7); 
      HSSFCell name_c1 = row1.createCell(0); 
      name_c1.setCellValue(name); 
      name_c1.setCellStyle(style); 

      file.close(); 

      FileOutputStream outFile =new FileOutputStream(new File("//Users//"+ usr +"//Desktop//TNA//output//FR-OPS-030 Master Training Plan_Rev41w.xls")); 
      workbook.write(outFile); 
      outFile.close(); 
     } 
     catch(Exception ex) 
     { 
      System.out.println(ex);     
     } 

我使用該代碼從文件夾中讀取PDF文件。它對單個文檔工作正常,但文件夾中有多個文件。我如何閱讀PDF多個文件。請指點Java - 讀取文件夾中的所有pdf文件

回答

相關問題