public class PdfByteReader {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String filePath = args[0];
try {
String pdfContent = readPdfFileByteByByte(filePath);
System.out.println(pdfContent);
} catch (IOException e) {
System.err.println("ERROR" + e.getMessage());
}
}
public static String readPdfFileByteByByte(String filePath) throws IOException {
File pdfFile = new File(filePath);
StringBuilder content = new StringBuilder();
try (FileInputStream fis = new FileInputStream(pdfFile)) {
int byteRead;
while ((byteRead = fis.read()) != -1) {
content.append((char) byteRead);
}
}
return content.toString();
}
}
Я могу создать файл JAR или создать агент Java в приложении Lotus Notes, но: как я могу получить из сценария лотоса возвращаемое значение этой (строки)?
Я пытаюсь проанализировать файл PDF в строку, чтобы загрузить его в API>
public static String readPdfFileByteByByte(String filePath) throws IOException { File pdfFile = new File(filePath); StringBuilder content = new StringBuilder();
try (FileInputStream fis = new FileInputStream(pdfFile)) { int byteRead; while ((byteRead = fis.read()) != -1) { content.append((char) byteRead); } }
return content.toString(); }
} [/code] Я могу создать файл JAR или создать агент Java в приложении Lotus Notes, но: как я могу получить из сценария лотоса возвращаемое значение этой (строки)? Я пытаюсь проанализировать файл PDF в строку, чтобы загрузить его в API>