Author: vsalaun Date: 2011-08-02 16:26:15 +0200 (Tue, 02 Aug 2011) New Revision: 3243 Url: http://chorem.org/repositories/revision/lima/3243 Log: #347 display PDF boxes inside the pdf Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/DocumentServiceImpl.java 2011-08-02 14:26:15 UTC (rev 3243) @@ -36,7 +36,6 @@ import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.Date; Modified: trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java =================================================================== --- trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-02 11:39:58 UTC (rev 3242) +++ trunk/lima-business/src/main/java/org/chorem/lima/business/ejb/ImportServiceImpl.java 2011-08-02 14:26:15 UTC (rev 3243) @@ -53,6 +53,7 @@ import org.apache.commons.logging.LogFactory; import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.pdmodel.interactive.form.PDField; import org.chorem.lima.FinancialStatementWayEnum; import org.chorem.lima.beans.AccountEBP; import org.chorem.lima.beans.AccountEBPImpl; @@ -650,7 +651,7 @@ String path = LimaConfig.getInstance().getReportsDir(); String filePath = - path+File.separator+DocumentsEnum.VAT.getFileName()+".pdf"; + path+File.separator + DocumentsEnum.VAT.getFileName() + "_structure.pdf"; PDDocument doc = null; InputStream reportsStream = new FileInputStream(datas); @@ -658,6 +659,15 @@ //DocumentServiceImpl.class.getResourceAsStream("~"+datas); // load the document doc = PDDocument.load(reportsStream); + + //search for all PDFBox + List<PDField> FieldList = doc.getDocumentCatalog().getAcroForm().getFields(); + + //display inside each box their name + for (PDField pdField : FieldList) { + pdField.setValue(pdField.getFullyQualifiedName()); + } + // save the updated document to the new file and close if (saveMode) { doc.save(filePath);