I'm able to convert xhtml to pdf file, but the value in each input tag can not be displayed in my exported pdf. Please can anyone help me or guide me to the right topic. Here is what I'm doing
- Code: Select all
InputStream is = //code to get content input stream
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(is);
CustomXmlDataStoragePart[] xmlParts =
wordMLPackage.getCustomXmlDataStorageParts().values().toArray(new CustomXmlDataStoragePart[0]);
OpenDoPEHandler openDoPEHandler = new OpenDoPEHandler(wordMLPackage);
OpenDoPEIntegrity openDoPEIntegrity = new OpenDoPEIntegrity();
// replace the xml with actual data from the data source
xmlParts[0].getData().setDocument(new ByteArrayInputStream(sourceXml.getBytes()));
// process the xml content with binding components
openDoPEHandler.preprocess();
openDoPEIntegrity.process(wordMLPackage);
BindingHandler.applyBindings(wordMLPackage.getMainDocumentPart());
FileBackedOutputStream os = new FileBackedOutputStream(THRESHOLD);
RemovalHandler rh = new RemovalHandler();
rh.removeSDTs(wordMLPackage, Quantifier.ALL);
SaveToZipFile saver = new SaveToZipFile(wordMLPackage);
saver.save(os);
And my html code
- Code: Select all
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
<style type="text/css">
#form_container
{
background:#fff;
border:1px solid #ccc;
margin:0 auto;
text-align:left;
width:682px;
}
.appnitro {
font-family: Arial,Helvetica,Tahoma,Verdana,sans-serif;
}
label.description {
border: medium none;
color: #222222;
display: block;
font-size: 10pt;
line-height: 130%;
padding: 0 0 1px;
}
#top
{
display:block;
height:10px;
margin:10px auto 0;
width:682px;
}
#footer a{
color:#999999;
text-decoration: none;
border-bottom: 1px dotted #999999;
}
#bottom
{
display:block;
height:10px;
margin:0 auto;
width:682px;
}
.appnitro
{
margin:20px 20px 0;
padding:0 0 20px;
}
form li:after {
clear: both;
display: block;
height: 0;
visibility: hidden;
}
form li.section_break {
padding-bottom: 0;
padding-left: 9px;
padding-top: 13px;
width: 97% !important;
}
.appnitro li {
width: 61%;
}
form li {
display: block;
margin: 0;
padding: 4px 5px 2px 9px;
position: relative;
}
h1.Header
{
background-color:#dedede;
margin:0;
min-height:0;
padding:0;
text-decoration:none;
text-indent:-8000px;
}
h1.Header a
{
display:block;
height:40px;
overflow:hidden;
}
.form_description
{
clear:both;
display:inline-block;
margin:0 0 1em;
}
.form_description[class]
{
display:block;
padding-left:9px;
}
.form_description h2
{
clear:left;
font-size:1.5em;
margin:0 0 3px;
}
.form_description p
{
font-size:12px;
margin:0 0 12px;
}
form ul {
font-size: 10pt;
list-style-type: none;
margin: 0;
padding: 0;
width: 100%;
}
.form_description[class] {
display: block;
padding-left: 9px;
}
.form_description {
clear: both;
display: inline-block;
margin: 0 0 1em;
}
</style>
</head>
<div id="form_container">
<h1 class="Header"><a>My sample header</a></h1>
<form id="form_595650" class="appnitro" method="post" action="">
<div class="form_description">
<center><b><h1>Sample</h1></b></center>
<p>The longest paragraph ever
</p>
</div>
<ul >
<h2>User Information:</h2>
<p>Please note that if ANY of the information that is pre-populated in this Section: User Information is incorrect, you MUST FIRST update your personal information.</p>
<li class="section_break">
<h3>1. User Information:</h3>
<table class="Information_tbl">
<tr>
<td class="BorderNone" width="280px"><label class="description" for="element_firstName">First Name: </label></td>
<td><input style="width:255px" id="element_firstName" name="element_firstName" class="element text medium" type="text" maxlength="255"></input> </td>
</tr>
<tr>
<td class="BorderNone" width="280px"><label class="description" for="element_lastName">Last Name: </label></td>
<td><input style="width:255px" id="element_lastName" name="element_lastName" class="element text medium" type="text" maxlength="255"></input></td>
</tr>
<tr>
<td class="BorderNone" width="280px"><label class="description" for="element_email">Email Address: </label></td>
<td><input style="width:255px" id="element_email" name="element_email" class="element text medium" type="text" maxlength="255"/> </td>
</tr>
</table><br></br>
</li>
</ul>
</form>
</div>
</html>
Attached is my sample docx template.
Thanks in advanced