parent
f63e2d701a
commit
bb9508c389
@ -1,10 +1,39 @@ |
||||
package com.bupt.note; |
||||
|
||||
import org.apache.pdfbox.pdmodel.PDDocument; |
||||
import org.apache.pdfbox.text.PDFTextStripper; |
||||
import org.junit.jupiter.api.Test; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
|
||||
public class MyTest { |
||||
@Test |
||||
public void test1() { |
||||
System.out.println(String.format("%d=%d", 1, 1L)); |
||||
} |
||||
|
||||
|
||||
@Test |
||||
public void testPDF() throws IOException { |
||||
PDDocument document = PDDocument.load(new File("E:\\JetBrains\\PycharmProjects\\python_requirements_summary\\libcon\\Management+Game环境下戴乐国际表业有限公司总体战略规划.pdf")); |
||||
PDFTextStripper s = new PDFTextStripper(); |
||||
// for (PDPage page : document.getPages()) {
|
||||
//
|
||||
//
|
||||
//
|
||||
// ByteArrayOutputStream result = new ByteArrayOutputStream();
|
||||
// byte[] buffer = new byte[1024];
|
||||
// int length;
|
||||
// while ((length = page.getContents().read(buffer)) != -1) {
|
||||
// result.write(buffer, 0, length);
|
||||
// }
|
||||
//// String f = new String(result.toByteArray());
|
||||
//// System.out.println(f);
|
||||
// }
|
||||
// s.setArticleStart(" ");
|
||||
// s.setParagraphEnd(" .\n");
|
||||
System.out.println(s.getText(document)); |
||||
|
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue