顶
踩
<a href="/blog/1115059" class="pre" title="固定table表头">固定table表头</a>
</div>
- 2011-08-19 10:17
- 浏览 8781
- 评论(0)
-
<li>分类:<a href="https://www.iteye.com/blogs/category/language">编程语言</a></li> <li class="last"><a href="https://www.iteye.com/wiki/blog/1153078" target="_blank" class="more">查看更多</a></li> </ul>
发表评论
相关资源推荐
-
<li class="news-recommends-ajax"> <a href="https://blog.csdn.net/sprionzgyp/article/details/79583391" data-track-click="{"con":",https://blog.csdn.net/sprionzgyp/article/details/79583391,-","mod":"popu_712"}" target="_blank" title="使用iText导出PDF文件(支持中文,解析html)">使用<em class="related_suggestion_highlight">iText</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">PDF</em>文件(支持中文,解析html)</a> <p> 导读:本文介绍如何使用<em class="related_suggestion_highlight">iText</em><em class="related_suggestion_highlight">Pdf</em><em class="related_suggestion_highlight">导出</em>中文<em class="related_suggestion_highlight">PDF</em>文件,不当之处,请指出。一:前期准备1,加入依赖: &amp;lt;!--<em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">pdf</em>相关--&amp;gt; &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;com.<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">pdf</em>&amp;lt;/groupId&amp;gt; &amp;lt;artifactId&amp;gt;<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">pdf</em>&amp;lt;/a... </p> </li> <li class="news-recommends-ajax"> <a href="https://blog.csdn.net/u011498933/article/details/56843547" data-track-click="{"con":",https://blog.csdn.net/u011498933/article/details/56843547,-","mod":"popu_712"}" target="_blank" title="Itext设置导出word文件的字体"><em class="related_suggestion_highlight">Itext</em>设置<em class="related_suggestion_highlight">导出</em>word文件的字体</a> <p> 首先,要导入<em class="related_suggestion_highlight">Itext</em>的三个jar包:<em class="related_suggestion_highlight">iText</em>-2.1.7.jar,<em class="related_suggestion_highlight">itext</em>-rtf-2.1.7.jar,<em class="related_suggestion_highlight">iText</em>Asian.jar;
其次,Itext里面设置导出word文件的字体,用RtfFont这个类的初始化方法进行设置;
RtfFont font =new RtfFont(“仿 宋”, 12, Font.NORMAL, Color.BLACK);
这个构造方法里面:第一个参数
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/xxj_jing/article/details/70888801" data-track-click="{"con":",https://blog.csdn.net/xxj_jing/article/details/70888801,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/xxj_jing/article/details/70888801,-","mod":"popu_712"}" target="_blank" title="java-pdf-itext 生成pdf 文档(支持中文字体)">java-<em class="related_suggestion_highlight">pdf</em>-<em class="related_suggestion_highlight">itext</em> 生成<em class="related_suggestion_highlight">pdf</em> 文档(支持中文字体)</a>
<p>
java-<em class="related_suggestion_highlight">pdf</em>-<em class="related_suggestion_highlight">itext</em> 生成<em class="related_suggestion_highlight">pdf</em> 文档(支持中文字体)
itext 版本:2.1.7
package com.demo.preview;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOExceptio
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/xxj_jing/article/details/72714580" data-track-click="{"con":",https://blog.csdn.net/xxj_jing/article/details/72714580,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/xxj_jing/article/details/72714580,-","mod":"popu_712"}" target="_blank" title="java-pdf-itext7、itextpdf 生成pdf 文档,使用pdf模板生成(支持中文字体)">java-<em class="related_suggestion_highlight">pdf</em>-<em class="related_suggestion_highlight">itext</em>7、<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">pdf</em> 生成<em class="related_suggestion_highlight">pdf</em> 文档,使用<em class="related_suggestion_highlight">pdf</em>模板生成(支持中文字体)</a>
<p>
java-<em class="related_suggestion_highlight">pdf</em>-<em class="related_suggestion_highlight">itext</em>7、<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">pdf</em> 生成<em class="related_suggestion_highlight">pdf</em> 文档(支持中文字体)
itext7 内置对中文(CJK字体)进行了支持,不在依赖其他组件。
//处理中文问题
PdfFont font = PdfFontFactory.createFont(“STSongStd-Light”, “UniGB-UCS2-H”, false);
一、iText 7 资料:
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/daidalei/article/details/84004244" data-track-click="{"con":",https://blog.csdn.net/daidalei/article/details/84004244,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/daidalei/article/details/84004244,-","mod":"popu_712"}" target="_blank" title="itext导出pdf字体设置"><em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">pdf</em><em class="related_suggestion_highlight">字体设置</em></a>
<p>
</p>
</li>
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/sun215153/article/details/9715623" data-track-click="{"con":",https://blog.csdn.net/sun215153/article/details/9715623,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/sun215153/article/details/9715623,-","mod":"popu_712"}" target="_blank" title="Itext导出PDF,linux下字体 不能显示的问题"><em class="related_suggestion_highlight">Itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">PDF</em>,linux下字体 不能显示的问题</a>
<p>
这个问题纠结了好久,最后解决的办法是,将windows下面的字体<em class="related_suggestion_highlight">导出</em>成一个jar放入项目,就可以了。
</p>
</li>
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/LWJdear/article/details/78655504" data-track-click="{"con":",https://blog.csdn.net/LWJdear/article/details/78655504,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/LWJdear/article/details/78655504,-","mod":"popu_712"}" target="_blank" title="【java】 iText使用PDF模板生成输出PDF 这个比较清晰">【java】 <em class="related_suggestion_highlight">iText</em>使用<em class="related_suggestion_highlight">PDF</em>模板生成输出<em class="related_suggestion_highlight">PDF</em> 这个比较清晰</a>
<p>
转载自:http://blog.csdn.net/leeyefang/article/details/46805617
本文所要用到的工具或jar主要有:
Adobe Acrobat 这个主要用来制作PDF模板、eclipse、 itext.jar、 解决中文的输出问题,需要多下载一个名为iTextAsian.jar的JAR包。这个包里面定义了与中文输出相关的一些文件。
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/weixin_37690143/article/details/79817050" data-track-click="{"con":",https://blog.csdn.net/weixin_37690143/article/details/79817050,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/weixin_37690143/article/details/79817050,-","mod":"popu_712"}" target="_blank" title="利用itext将html文件转化pdf文件(四)——字体样式">利用<em class="related_suggestion_highlight">itext</em>将html文件转化<em class="related_suggestion_highlight">pdf</em>文件(四)——字体样式</a>
<p>
在利用<em class="related_suggestion_highlight">itext</em>将html文件转化为<em class="related_suggestion_highlight">pdf</em>文件的过程中,需要适当的调整字体,下面介绍字体的使用样式:字体支持的样式 <em class="related_suggestion_highlight">itext</em>核心库中主要支持一下几个各种的字体文件:.AFM/.PFB/.TTF/.otf/.ttc/.wof 2. 利用DefaultFontProvider 只是支持 14 Standard Type 1 fonts and 12 fonts 主要字体...
</p>
</li>
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/tangedegushi/article/details/81539320" data-track-click="{"con":",https://blog.csdn.net/tangedegushi/article/details/81539320,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/tangedegushi/article/details/81539320,-","mod":"popu_712"}" target="_blank" title="Android使用Itext生成pdf文件">Android使用<em class="related_suggestion_highlight">Itext</em>生成<em class="related_suggestion_highlight">pdf</em>文件</a>
<p>
对于生成<em class="related_suggestion_highlight">pdf</em>文件,上一篇文章介绍了使用android原生的方式生成<em class="related_suggestion_highlight">pdf</em>,使用android原生的方式对于将view上的内容生成<em class="related_suggestion_highlight">pdf</em>非常的简单,但有缺憾,就是生成的<em class="related_suggestion_highlight">pdf</em>文佳很多,对于在项目中需要将生成的<em class="related_suggestion_highlight">pdf</em>文件发送出去,这时就会发现发送的时间有点长了,这对于用户来说肯定是不可以接受的了,所以就有了这里接受的<em class="related_suggestion_highlight">Itext</em>了。
对于Itext,主要有两个版本,一个是5.x,另一个是7.x,这两…
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/u012151597/article/details/52900049" data-track-click="{"con":",https://blog.csdn.net/u012151597/article/details/52900049,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/u012151597/article/details/52900049,-","mod":"popu_712"}" target="_blank" title="java 使用itext导出PDF文件,图片文字左右布局">java 使用<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">PDF</em>文件,图片文字左右布局</a>
<p>
java 使用<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">PDF</em>文件,带图片布局。<em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">pdf</em>效果如下代码代码块语法遵循标准markdown代码,例如:/**
-
思路:使用嵌套表格对象完成数据,图片左右布局
-
1、创建document对象。
-
2、创建表格对象PdfPTable headerTable。两列的表格对象。图片分为一列,数据划分为一列。
-
3、创建左边数据表格PdfPTable iTable,划分为N列
<li class="news-recommends-ajax"> <a href="https://blog.csdn.net/qq876551724/article/details/81095703" data-track-click="{"con":",https://blog.csdn.net/qq876551724/article/details/81095703,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/qq876551724/article/details/81095703,-","mod":"popu_712"}" target="_blank" title="Java解决Itext pdf中文不显示问题(保留html属性的方式)">Java解决<em class="related_suggestion_highlight">Itext</em> <em class="related_suggestion_highlight">pdf</em>中文不显示问题(保留html属性的方式)</a> <p> Java解决<em class="related_suggestion_highlight">Itext</em> <em class="related_suggestion_highlight">pdf</em>中文不显示问题 </p> </li> <li class="news-recommends-ajax"> <a href="https://blog.csdn.net/u012283400/article/details/72782976" data-track-click="{"con":",https://blog.csdn.net/u012283400/article/details/72782976,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/u012283400/article/details/72782976,-","mod":"popu_712"}" target="_blank" title="Java利用Itext导出pdf">Java利用<em class="related_suggestion_highlight">Itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">pdf</em></a> <p> 本文概述了如何通过<em class="related_suggestion_highlight">Itext</em>生成包含表格的<em class="related_suggestion_highlight">pdf</em>文档,包含简单的表格格式设置,迭代添加表格数据等实践。解决了中文字不能显示或显示乱码的问题。最后输出到HttpResponse流中供用户下载。本文提供的示例较为直观简单,仅做抛砖引玉之用。jar包下载
itextpdf-5.3.2.jar
itext-asian.jar(解决中文显示)
Itext使用工具类/**
-
@author zhangt
<li class="news-recommends-ajax"> <a href="https://blog.csdn.net/weixin_41478499/article/details/80217087" data-track-click="{"con":",https://blog.csdn.net/weixin_41478499/article/details/80217087,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/weixin_41478499/article/details/80217087,-","mod":"popu_712"}" target="_blank" title="利用iText技术导出PDF到本地">利用<em class="related_suggestion_highlight">iText</em>技术<em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">PDF</em>到本地</a> <p> //从数据库将数据表格用<em class="related_suggestion_highlight">pdf</em><em class="related_suggestion_highlight">导出</em>
//模拟列表数据
List&lt;String[]&gt; list = new ArrayList&lt;&gt;();
String[] ss1={&quot;七月份&quot;,&quot;1999&quot;,&quot;800&quot;};
String[] ss2={&quot;八月份&quot;,&quot;2999&quot;,&quot;900&quot;};
St
</p>
</li>
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/xygg0801/article/details/53286502" data-track-click="{"con":",https://blog.csdn.net/xygg0801/article/details/53286502,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/xygg0801/article/details/53286502,-","mod":"popu_712"}" target="_blank" title="使用iText导出word和pdf(经典)">使用<em class="related_suggestion_highlight">iText</em><em class="related_suggestion_highlight">导出</em>word和<em class="related_suggestion_highlight">pdf</em>(经典)</a>
<p>
</p>
</li>
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/qq_39028580/article/details/80292642" data-track-click="{"con":",https://blog.csdn.net/qq_39028580/article/details/80292642,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/qq_39028580/article/details/80292642,-","mod":"popu_712"}" target="_blank" title="JAVA ITEXT5 导出为PDF(三) HTML页面导出PDF文件">JAVA <em class="related_suggestion_highlight">ITEXT</em>5 <em class="related_suggestion_highlight">导出</em>为<em class="related_suggestion_highlight">PDF</em>(三) HTML页面<em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">PDF</em>文件</a>
<p>
在(一)的背景下,直接将HTML页面<em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">PDF</em>文件(此情况数据<em class="related_suggestion_highlight">导出</em>不完整):// step 1
Document document = new Document();
// step 2
// response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment;filen…
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/zhuce0001/article/details/51964860" data-track-click="{"con":",https://blog.csdn.net/zhuce0001/article/details/51964860,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/zhuce0001/article/details/51964860,-","mod":"popu_712"}" target="_blank" title="iText生成pdf中文字体解决方案"><em class="related_suggestion_highlight">iText</em>生成<em class="related_suggestion_highlight">pdf</em>中文字体解决方案</a>
<p>
相信用过<em class="related_suggestion_highlight">itext</em>的朋友都知道,中文显示一直都是个问题(最新版5.5.7官方也没直接集成中文字体)。
当然这样的问题,早就有高手解决了,那就是使用iTextAsian.jar。
但是本文介绍的,不是使用iTextAsian.jar,而是另一种解决方法。
在此之前,需要准备的仅仅为itextpdf-5.x.jar 和一个 ttf格式的中文字体。比如我们常用的宋体simsun.ttf。
我们首
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/Feb_kylin/article/details/79105630" data-track-click="{"con":",https://blog.csdn.net/Feb_kylin/article/details/79105630,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/Feb_kylin/article/details/79105630,-","mod":"popu_712"}" target="_blank" title="java使用itext导出pdf,图片、表格、背景图">java使用<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">pdf</em>,图片、表格、背景图</a>
<p>
<em class="related_suggestion_highlight">导出</em>效果如下代码1、常用的几个方法放到了一个工具类中import com.<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">pdf</em>.text.Element;
import com.itextpdf.text.Font;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.pdf.PdfPCell;
/**
-
@Description: pdf工具类
-
@a
<li class="news-recommends-ajax"> <a href="https://blog.csdn.net/weixin_37690143/article/details/79813556" data-track-click="{"con":",https://blog.csdn.net/weixin_37690143/article/details/79813556,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/weixin_37690143/article/details/79813556,-","mod":"popu_712"}" target="_blank" title="利用iText将html转为pdf设置不同的样式以及报表">利用<em class="related_suggestion_highlight">iText</em>将html转为<em class="related_suggestion_highlight">pdf</em>设置不同的样式以及报表</a> <p> 本教程只是作为自己的总结使用,主要参考于官网的文档:https://developers.<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">pdf</em>.com/这个是一系列的介绍的方式,转化<em class="related_suggestion_highlight">pdf</em>入门请转入:利用<em class="related_suggestion_highlight">itext</em>将html文件转化<em class="related_suggestion_highlight">pdf</em>文件这里我们介绍几个关于<em class="related_suggestion_highlight">pdf</em>输出的形式。1、将生成的<em class="related_suggestion_highlight">pdf</em>文件作为输出的媒体形式在这里面引入MediaDeviceDescription属性,用来设置ConverterProperties添加在转... </p> </li> <li class="news-recommends-ajax"> <a href="https://blog.csdn.net/JE_GE/article/details/84834529" data-track-click="{"con":",https://blog.csdn.net/JE_GE/article/details/84834529,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/JE_GE/article/details/84834529,-","mod":"popu_712"}" target="_blank" title="Spring Boot 系列教程18-itext导出pdf下载">Spring Boot 系列教程18-<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">pdf</em>下载</a> <p> Java操作<em class="related_suggestion_highlight">pdf</em>框架
iText是一个能够快速产生PDF文件的java类库。iText的java类对于那些要产生包含文本,表格,图形的只读文档是很有用的。它的类库尤其与java Servlet有很好的给合。使用iText与PDF能够使你正确的控制Servlet的输出。
http://itextpdf.com/
最终下载效果
pom.xml
&lt;!– itext方式…
<li class="news-recommends-ajax">
<a href="https://blog.csdn.net/wjx_jasin/article/details/80591531" data-track-click="{"con":",https://blog.csdn.net/wjx_jasin/article/details/80591531,-","mod":"popu_712"}" data-track-view="{"con":",https://blog.csdn.net/wjx_jasin/article/details/80591531,-","mod":"popu_712"}" target="_blank" title="【pdf】使用itext生成pdf的,各种布局和使用itext导出pdf,图片、表格、背景图">【<em class="related_suggestion_highlight">pdf</em>】使用<em class="related_suggestion_highlight">itext</em>生成<em class="related_suggestion_highlight">pdf</em>的,各种布局和使用<em class="related_suggestion_highlight">itext</em><em class="related_suggestion_highlight">导出</em><em class="related_suggestion_highlight">pdf</em>,图片、表格、背景图</a>
<p>
一、使用<em class="related_suggestion_highlight">itext</em>生成<em class="related_suggestion_highlight">pdf</em>的,各种布局代码如下,jar包为<em class="related_suggestion_highlight">itext</em>.jar,<em class="related_suggestion_highlight">itext</em>Asia.jar,最好都是最新的 ;2张图片也在最后贴出,把图片放到D盘可以直接生成制定格式的<em class="related_suggestion_highlight">pdf</em>。 最后生成的<em class="related_suggestion_highlight">pdf</em>如下: 代码如下:package com.<em class="related_suggestion_highlight">itext</em>.test;
import java.io.FileOutputStream;
import com.itextpdf.text.Ba…
</ul>
</div>
</div>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/34539.html
评论