|
|
@ -1,7 +1,13 @@
|
|
|
|
package com.dsic.gj_erp;
|
|
|
|
package com.dsic.gj_erp;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
|
|
|
|
|
import org.apache.pdfbox.text.PDFTextStripper;
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
import org.springframework.boot.SpringApplication;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
|
|
|
import java.nio.file.Paths;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.LocalDate;
|
|
|
|
import java.time.Period;
|
|
|
|
import java.time.Period;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -9,10 +15,23 @@ import java.util.regex.Matcher;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
import java.util.regex.Pattern;
|
|
|
|
|
|
|
|
|
|
|
|
public class Test {
|
|
|
|
public class Test {
|
|
|
|
public static void main(String[] args) {
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
|
|
String aaa="gagagag";
|
|
|
|
//String aaa="gagagag";
|
|
|
|
//System.out.println(aaa.split("@")[0]);
|
|
|
|
//System.out.println(aaa.split("@")[0]);
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("aaa = " + String.format("%03d",1));
|
|
|
|
//System.out.println("aaa = " + String.format("%03d",1));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String pdfFilePath = "E:/B046HC103HN第046批量数控套料图2023-05-11.pdf"; // PDF文件路径
|
|
|
|
|
|
|
|
PDDocument document = PDDocument.load(new File(pdfFilePath));
|
|
|
|
|
|
|
|
PDFTextStripper stripper = new PDFTextStripper();
|
|
|
|
|
|
|
|
String text = stripper.getText(document);
|
|
|
|
|
|
|
|
document.close();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 输出提取的文本到控制台
|
|
|
|
|
|
|
|
System.out.println(text);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 可以选择将文本写入文件
|
|
|
|
|
|
|
|
String outputPath = "E:/B046HC103HN第046批量数控套料图2023-05-11.txt"; // 输出文本文件路径
|
|
|
|
|
|
|
|
Files.write(Paths.get(outputPath), text.getBytes());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|