Commit b0cd68a6 authored by 9731073's avatar 9731073

initial commit

parent 113bb265
Pipeline #328 failed with stages
......@@ -16,8 +16,7 @@ public class Main {
Document document = new Document();
//Create OutputStream instance.
OutputStream outputStream =
new FileOutputStream(new File("C:\\TestFile.pdf"));
OutputStream outputStream = new FileOutputStream(new File("TestFile.pdf"));
//Create PDFWriter instance.
PdfWriter.getInstance(document, outputStream);
......@@ -26,8 +25,7 @@ public class Main {
document.open();
//Add content to the document.
document.add(new Paragraph("Hello world, " +
"this is a test pdf file."));
document.add(new Paragraph("Hello world, " + "this is a test pdf file."));
//Close document and outputStream.
document.close();
......@@ -36,7 +34,7 @@ public class Main {
System.out.println("Pdf created successfully.");
PdfReader pdfReader=new PdfReader("C:\\Users\\Surface\\IdeaProjects\\lab4\\src\\com\\company\\Lab-4.pdf");
int pages = pdfReader.getNumberOfPages();
// PdfTextExtractor(pdfReader.getNumberOfPages());
//PdfTextExtractor(pdfReader.getNumberOfPages());
for (int i=1; i<=pages; i++) {
String pageContent = PdfTextExtractor.getTextFromPage(pdfReader, i);
System.out.println("Content on Page " + i + ": " + pageContent);
......
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