我正在尝试设计一个打印页面,其中将从服务器端(此处为jsp scriptlet)读取数量,字数,日期等值。在空白支票上打印此页面时,应该使用scriplet值出现在相应的标签上。
我编写了html代码来调整这些值:
<div style="width:767.244094488px; float:left; height:71.811023622px;">
<div style="width:151.181102362px; height:18.897637795px; float:right; margin-right:0.456692913px; font-family:Arial, Helvetica, sans-serif; letter-spacing:13px; line-height:18.897637795px; font-size:15px;"><%=date%></div>
</div>
<div style="float:left; height:351.496062992px; width:767.244094488px;" id="printdiv"><br>
<div style="width:width:767.244094488px; height:26.456692913px; float:left;">
<div style="width:540.472440945px;height:26.456692913px; line-height:26.456692913px; margin-left:56px; font-family:Arial, Helvetica, sans-serif; font-size:15px; color:#000;">** <%=payee%> **</div>
</div><br><br>
<div style="width:width:767.244094488px; height:26.456692913px; float:left;">
<div style="width:453.543307087px;height:26.456692913px; line-height:26.456692913px; margin-left:76px; font-family:Arial, Helvetica, sans-serif; font-size:15px; color:#000;"><%= amt1 %></div>
</div>
<div style="width:width:767.244094488px; height:26.456692913px; float:left;">
<div style="width:453.543307087px;height:26.456692913px; line-height:26.456692913px; margin-left:76px; font-family:Arial, Helvetica, sans-serif; font-size:15px; color:#000;"><%= amt2 %></div>
</div>
<br>
<div style="width:188.976377953px;height:26.456692913px; float:left; line-height:26.456692913px; margin-left:2px; font-family:Arial, Helvetica, sans-serif; font-size:15px; color:#000;">
<div style="width:143.622047244px; height:26.456692913px; line-height:26.456692913px; margin-left:70.354330709px; letter-spacing:1px; font-size:15px; font-weight:bold;">** <%=amount%> **</div>
</div>
</div>
页面大小在css中定义为:
body {
height: 4in;
width: 8in;
position:absolute;
}
上面定义的宽度是通过手动测量以mm为单位的检查尺寸然后将其转换为像素来计算的。 当我打印出来时,这些值不会出现在预期的相应标签前面。