用于PDF到图像转换的开源库 [英] Open Source libraries for PDF to image conversion
问题描述
可能重复:
将PDF页面导出为Java中的一系列图像
请建议一些好的java库,它们可以用于PDF文件到图像的转换。
我尝试使用PDFBox: http://pdfbox.apache.org/ 但转换为我的pdf文件中的大部分文字在图像中都是乱码。它将'T'读作'Y','C'作为'#'等等。
Please suggest some good java libraries which can be used for a PDF file to image conversion. I tried using PDFBox: http://pdfbox.apache.org/ but after conversion to image most of my text from the pdf file was garbled in the image. It read a 'T' as a 'Y' a 'C' as a '#' and so on.
以下是我用于相同的代码片段:
Following is the code snippet I used for the same:
PDDocument document = null;
document = PDDocument.load( pdfFile );
List pages = document.getDocumentCatalog().getAllPages();
for( int i=startPage-1; i<endPage && i<pages.size(); i++ )
{
try
{
PDPage page = (PDPage)pages.get( i );
BufferedImage image = page.convertToImage();
}
}
document.close();
我想这是渲染字体的一些问题。
如果您认为我在使用PDFBox时可能遗漏了一些内容,请告知我们。
I guess it is some issue that they have with rendering fonts. In case u think I might have missed something out while using PDFBox please let me know.
请同时推荐其他替代方案。
Please suggest any other alternatives as well.
我尝试过使用jPedal: http://www.jpedal.org/ 虽然效果很好但不是免费的,所以请在此建议所有好的选择。
I have tried using jPedal: http://www.jpedal.org/ which works out fine but its not free so please suggest about all good alternatives on this.
推荐答案
尝试 icePDF
这篇关于用于PDF到图像转换的开源库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!