*/
public class PDFFillerTester {
public static void execute(String xmlFile, String originalPdf, String finalPdf) throws IOException, JDOMException, DocumentException {
XmlBuilder builder = new XmlBuilder(true);
builder.setSchema("PDF_Placer.xsd", false);
List errors = builder.parse(new FileReader(xmlFile));
if (errors != null && !errors.isEmpty()) {
System.out.println("O ficheiro " + xmlFile + " cont�m erros:");
for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
SAXParseException parseException = (SAXParseException) iterator.next();
System.out.println("[" + parseException.getLineNumber() + "]: " + parseException.getLocalizedMessage());
}
} else {
PDFFiller filler = new PDFFiller(builder.getDocument());
filler.fill(originalPdf, new FileOutputStream(finalPdf), new HashMap()); // mapa de valores vai vazio em testes
}
}