flying saucer+itext+freemarker div内容显示不完整及没有调用jBarcodeServlet条码生成方法

qq_39924172 2017-08-21 05:03:40
问题背景
1、打印模板如图,是由公司的UI自己写的

2、画好模板之后、把模板内容保存到数据库,保存的内容下
<div class="label-content ui-draggable" style="width: 95mm; height: 95mm; margin-left: -47.5mm; display: block;">
<div class="viewCover"></div>
<div class="ui-widget-content ui-droppable" id="custom-palette">
<div class="line-x senditem ui-draggable" data-type="line-x" data-title="水平线" data-max-width="349.046875" style="width: auto; height: auto; top: 0px; left: -0.046875px;"></div>
<div class="line-x senditem ui-draggable" data-type="line-x" data-title="水平线" data-max-width="349.046875" style="width: auto; height: auto; top: 349px; left: 0px;"></div>
<div class="line-y senditem ui-draggable" data-type="line-y" data-title="垂直线" data-max-height="349.046875" style="width: 0px; height: 349.047px; left: 348px; top: 0px;"></div>
<div class="line-y senditem ui-draggable" data-type="line-y" data-title="垂直线" data-max-height="349.046875" style="width: 0px; height: 349.047px; left: 0px; top: 0px;"></div>
<div class="barcode senditem ui-resizable ui-draggable" data-type="barcode" data-title="追踪条码" style="width: 306px; height: 83px; left: 20.5px; top: 40px; position: absolute;"><hls id="TRACK_NO_BARCODE">
<img src="/print/images/barcode.jpg"></hls><span class="codemunber" style="text-align: center;"><hls id="TRACK_NO">trackNo</hls></span>
<div class="ui-resizable-handle ui-resizable-e" style="z-index: 90;"></div>
<div class="ui-resizable-handle ui-resizable-s" style="z-index: 90;"></div>
<div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 90; opacity: 0;"></div></div></div>
</div>
我预览了一下 不是很好看。。。
3、下面是我显示的ftl模板,如图


我现在做的东西就是在后台把要显示的内容替换好数据后放到上图红框标记的div中

现在问题来了
我在网页上是已经做出想要的效果来了,如图所示
整个div是能够正常显示的,需要条码的地方
<img src="${appUrl}/jBarcodeServlet?code=${map.OrderInfo.trackNo}&height=7&ratio=3.4" />
也调用了jBarcodeServlet生成条码并显示了


然后问题是打印是要做接口提供给别人就需要PDF输出
我采用了flying saucer+itext+freemarker组合取实现
转换成PDF后两边的垂直线显示不完整,转换的时候也没有调用jBarcodeServlet方法去生成条码显示,如图

在贴出一下网页打印的时候的代码,如下
<div class="labelClass">

<div class="label-content ui-draggable" style="width: 95mm; height: 95mm; margin-left: -47.5mm; display: block;">
<div class="viewCover"></div>
<div class="ui-widget-content ui-droppable" id="custom-palette"><div class="line-x senditem ui-draggable" data-type="line-x" data-title="水平线" data-max-width="349.046875" style="width: auto; height: auto; top: 0px; left: -0.046875px;"></div><div class="line-x senditem ui-draggable" data-type="line-x" data-title="水平线" data-max-width="349.046875" style="width: auto; height: auto; top: 349px; left: 0px;"></div><div class="line-y senditem ui-draggable" data-type="line-y" data-title="垂直线" data-max-height="349.046875" style="width: 0px; height: 349.047px; left: 348px; top: 0px;"></div><div class="line-y senditem ui-draggable" data-type="line-y" data-title="垂直线" data-max-height="349.046875" style="width: 0px; height: 349.047px; left: 0px; top: 0px;"></div><div class="barcode senditem ui-resizable ui-draggable" data-type="barcode" data-title="追踪条码
" style="width: 306px; height: 83px; left: 20.5px; top: 40px; position: absolute;"><hls id="TRACK_NO_BARCODE"> <img src='http://localhost:9090//jBarcodeServlet?code=LAOCC1001155503YQ&height=5&ratio=3.4'/></hls><span class="codemunber" style="text-align: center;"><hls id="TRACK_NO">LAOCC1001155503YQ</hls></span><div class="ui-resizable-handle ui-resizable-e" style="z-index: 90;"></div><div class="ui-resizable-handle ui-resizable-s" style="z-index: 90;"></div><div class="ui-resizable-handle ui-resizable-se ui-icon ui-icon-gripsmall-diagonal-se" style="z-index: 90; opacity: 0;"></div></div></div>
</div>



走过路过的各位大神,麻烦帮看一下,
我搞了很久实在是搞不出来了
帖子分数是100分,我也不知道够不够,第一次逼得没办法了来CSDN上求助
如果能很好的解决问题,可以给额外的帮忙费(支付宝转账微信也可以,不会很多也就1、2包中档烟的钱)


...全文
243 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

81,094

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧