Commit 0917da8a authored by 9731016's avatar 9731016

last commit

parent 95ea6696
Pipeline #362 failed with stages
package PDF;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.parser.PdfTextExtractor;
public class PDFReaderTest {
public static void main(String[] args) {
try {
PdfReader pdfReader = new PdfReader("C:\\Users\\Mohsen\\Documents\\Java\\lab4\\TestFile.pdf");
int pages = pdfReader.getNumberOfPages();
for (int i = 1 ; i <= pages ; i++) {
String pageContent = PdfTextExtractor.getTextFromPage(pdfReader, i);
System.out.println("Content on Page " + i + ": " + pageContent);
}
} catch (Exception e){
e.printStackTrace();
}
}
}
import com.itextpdf.text.pdf.PdfReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
package PDF;
import com.itextpdf.text.Document;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.parser.PdfTextExtractor;
class PDFCreateExample {
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
public class PDFWriteTest {
public static void main(String[] args){
try {
//Create Document instance.
......@@ -35,19 +36,3 @@ class PDFCreateExample {
}
}
}
public class Main {
public static void main(String[] args) {
try {
PdfReader pdfReader = new PdfReader("C:\\Users\\Mohsen\\Documents\\Java\\lab4\\TestFile.pdf");
int pages = pdfReader.getNumberOfPages();
for (int i = 1 ; i <= pages ; i++) {
String pageContent = PdfTextExtractor.getTextFromPage(pdfReader, i);
System.out.println("Content on Page " + i + ": " + pageContent);
}
} catch (Exception e){
e.printStackTrace();
}
}
}
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