Commit ca6d3bdf authored by --global's avatar --global

adding the page reader

parent 920f00c8
Pipeline #315 canceled with stages
import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.parser.PdfTextExtractor;
public class Main { public class Main {
public static void main(String[] args) { public static void main(String[] args) {
PdfReader pdfr;
try { try {
PdfReader pdfr = new PdfReader("C:\\Users\\lab2\\Desktop\\Hello.pdf"); PdfReader pdfr = new PdfReader("C:\\Users\\lab2\\Desktop\\Hello.pdf");
int k = pdfr.getNumberOfPages(); int k = pdfr.getNumberOfPages();
for(int i =1 ; i <= k ; i++){
String content = PdfTextExtractor.getTextFromPage(pdfr , i);
System.out.println("the content of page " + i + " is :\n\n" + content);
}
System.out.println(k); System.out.println(k);
System.out.println(pdfr.getNumberOfPages()); System.out.println(pdfr.getNumberOfPages());
} catch (Exception e) { } catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment