I am using the itext and xmlworker for creating the pdf form xml/html for that i am using code below
public class XmlWorkerEx implements TagProcessor{
public static void main(String[] args) throws IOException, DocumentException{
Document document = new Document();
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("result.pdf"));
document.open();
HtmlPipelineContext htmlContext = new HtmlPipelineContext(null);
htmlContext.setTagFactory(Tags.getHtmlTagProcessorFactory());
CSSResolver cssResolver = XMLWorkerHelper.getInstance().getDefaultCssResolver(true);
Pipeline<?> pipeline = new CssResolverPipeline(cssResolver, new HtmlPipeline(htmlContext,new PdfWriterPipeline(document, writer)));
XMLWorker worker = new XMLWorker(pipeline, true);
XMLParser p = new XMLParser(worker);
p.parse(new FileInputStream("form.html"));
document.close();
}
and my html
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">
<html>
<head>
<style type="text/css">
.name{ font: 16px georgia ; }
.fl{float:left;width:100%; font: 16px georgia; }
.message {margin: 15px 0;width:500px;}
.sign span{ margin-top:5px; }
</style>
</head>
<body>
<div id="firstname"> Firstname ,</div>
<div class="message fl">
<P> Firstname is informed that This exemption is in accordance with Title 45 of the Code of Federal Regulations Part
46.102 (d) “a systematic investigation, including research development, testing, and evaluation, </p>
</div>
</body>
</html>
now i want to change the content of the div with the id firstname
... how to do that ?
<div><firstname>,</div>
instead of<div id="firstname">Firstname,</div>
. This sounds very much like a consultancy question; I'm not sure if it's eligible as a question for SO. – Bruno Lowagie Jun 13 '13 at 14:46