Hello
I have a little pdf filling program. Data come from csv . Pdf filled
with no error.
But when I want open there is an error message: Trailer not found.
Here is my code:
if (args.length != 3) {
System.out.println("Usage: PdfFill fillable.pdf data.csv
target.pdf");
System.exit(1);
}
DATASHEET = args[0];
CSV = args[1];
OUTPUTPDF = args[2];
try {
Reader csvreader = new FileReader(CSV);
CSVReader<String[]> csvParser =
CSVReaderBuilder.newDefaultReader(csvreader);
List<String[]> data = csvParser.readAll();
pdfreader = new PdfReader(DATASHEET);
stamper = new PdfStamper(pdfreader, new
FileOutputStream(OUTPUTPDF));
for (String[] szoveg : data) {
stamper.getAcroFields().setField(szoveg[0],
szoveg[1].trim());
}
stamper.setFormFlattening(true);
stamper.close();
pdfreader.close();
} catch (DocumentException dex) {
System.err.println("Document exception ");
System.exit(-1);
} catch (FileNotFoundException fnex) {
System.err.println("File not found exception");
System.exit(-1);
} catch (IOException iex) {
System.err.println("IO Exception ");
System.exit(-1);
}
------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php