peaceForEveryOne
2019-04-23 17:50使用Itext进行word转pdf失真 ,而poi的word转pdf就不失真。求教itext怎么不失真
如图,这是itext的word转pdf
代码如下:
XWPFDocument doc = new XWPFDocument(new FileInputStream(file));
// 以下几行代码是把这个word文件转化成pdf文件
File pdfFile = getPdfFile(FILE_TYPE_PDF);
fileOutputStream = new FileOutputStream(pdfFile);
PdfConverter.getInstance().convert(doc, fileOutputStream, PdfOptions.create());
下面这个是poi的word转pdf:
代码如下:
Document doc = new Document(new FileInputStream(file));
File pdfFile = getPdfFile(FILE_TYPE_PDF);
fileOutputStream = new FileOutputStream(pdfFile);
doc.save(fileOutputStream, SaveFormat.PDF);
itext的转完以后,文字紧贴着线,而poi的文字在中间!
求教。有没有遇到过同样的问题的?
- 点赞
- 回答
- 收藏
- 复制链接分享
0条回答
为你推荐
- 可运行jar运行报错,有main,不是jre版本问题,貌似是itext的问题
- java
- eclipse
- jar
- 1个回答
- 生成带有图像的PDF太慢了
- php
- performance
- 3个回答
- 利用itext生成pdf,如何向pdf中输出checkbox复选框
- java
- 0个回答
- 怎样用iText读取pdf文件?
- oo
- 0个回答
- java项目如何实现word转pdf ,Excel转pdf ,并且兼容office03和07版本
- word
- java
- excel
- 2个回答
换一换