Importing PDF to String in java -
i need extract text pdf file using java. found itext doesn't work way wanted to. here's code
package com.itextpdf.mavenproject1; import com.itextpdf.forms.pdfacroform; import com.itextpdf.forms.fields.pdfbuttonformfield; import com.itextpdf.forms.fields.pdfformfield; import com.itextpdf.io.font.fontconstants; import com.itextpdf.kernel.font.pdffontfactory; import com.itextpdf.kernel.geom.rectangle; import com.itextpdf.kernel.pdf.pdfdocument; import com.itextpdf.kernel.pdf.pdfreader; import com.itextpdf.text.pdf.parser.pdftextextractor; import com.itextpdf.kernel.pdf.pdfstring; import com.itextpdf.kernel.pdf.pdfwriter; import com.itextpdf.kernel.pdf.action.pdfaction; import com.itextpdf.kernel.pdf.annot.pdfannotation; import com.itextpdf.kernel.pdf.annot.pdftextannotation; import com.itextpdf.kernel.pdf.canvas.pdfcanvas; import com.itextpdf.kernel.pdf.canvas.parser.pdftextextractor; import com.itextpdf.test.annotations.wraptotest; import java.io.file; import java.io.ioexception; public class zczytywanie { public static void main(string args[]) throws ioexception { pdfdocument pdfdoc = new pdfdocument(new pdfreader("d:/pdf/pdf")); string page= pdftextextractor.gettextfrompage(pdfdoc, 1); system.out.println(page); } }
and tells me there error in line try use pddftextextractor (pdfdocument can not converted pdfpage, although found pdfdoc has pdfreader)
it doesn't work with
pdfreader pdfdoc = new pdfreader("d:/pdf/pdf");
either.
Comments
Post a Comment