pdf 转 高清图片
2016-10-28 11:47
225 查看
pdf转高清图片需要的jar:http://download.csdn.net/detail/emoven/9666543
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.icepdf.core.pobjects.Document;
import org.icepdf.core.util.GraphicsRenderingHints;
/*
* pdf 转 图片
*/
public class Icepdf {
public static void pdf2Pic(String pdfPath, String path){
Document document = new Document();
document.setFile(pdfPath);
float scale = 2.5f;//缩放比例
float rotation = 0f;//旋转角度
for (int i = 0; i < document.getNumberOfPages(); i++) {
BufferedImage image = (BufferedImage)
document.getPageImage(i, GraphicsRenderingHints.SCREEN, org.icepdf.core.pobjects.Page.BOUNDARY_CROPBOX, rotation, scale);
RenderedImage rendImage = image;
try {
String imgName = i + ".png";
System.out.println(imgName);
File file = new File(path + imgName);
ImageIO.write(rendImage, "png", file);
} catch (IOException e) {
e.printStackTrace();
}
image.flush();
}
document.dispose();
}
public static void main(String[] args) {
String filePath = "D:\\123.pdf";
pdf2Pic(filePath, "D:\\");
}
}
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import org.icepdf.core.pobjects.Document;
import org.icepdf.core.util.GraphicsRenderingHints;
/*
* pdf 转 图片
*/
public class Icepdf {
public static void pdf2Pic(String pdfPath, String path){
Document document = new Document();
document.setFile(pdfPath);
float scale = 2.5f;//缩放比例
float rotation = 0f;//旋转角度
for (int i = 0; i < document.getNumberOfPages(); i++) {
BufferedImage image = (BufferedImage)
document.getPageImage(i, GraphicsRenderingHints.SCREEN, org.icepdf.core.pobjects.Page.BOUNDARY_CROPBOX, rotation, scale);
RenderedImage rendImage = image;
try {
String imgName = i + ".png";
System.out.println(imgName);
File file = new File(path + imgName);
ImageIO.write(rendImage, "png", file);
} catch (IOException e) {
e.printStackTrace();
}
image.flush();
}
document.dispose();
}
public static void main(String[] args) {
String filePath = "D:\\123.pdf";
pdf2Pic(filePath, "D:\\");
}
}
相关文章推荐
- Java pdf转高清图片
- java实现pdf 转 高清图片
- 怎么把word转换pdf,pdf转换wprd ,pdf转换成高清图片
- [latex]图片动态缩放并旋转飞出的PDF动画示例
- 不用插件将 Safari 全页面保存为 PDF 或图片
- [100个改变摄影的伟大观念].(英)玛瑞恩.高清扫描版.pdf
- C#实现PDF文件添加图片背景
- 大阅兵盛况地面装备高清图片集合
- PHP实现html生成pdf、html生成图片 利用wkhtmltox,wkhtmltopdf扩展
- C# 压缩PDF图片
- 使用Aspose.Pdf删除PDF文件中的图片
- iOS:quartz2D绘图(显示绘制在PDF上的图片)
- 将PDF转换为图片(支持PDF含有多页内容)
- JPG图片转换成PDF格式的问题
- Java生成PDF文档(表格、列表、添加图片等)
- 新电脑2013年第1~7期高清PDF下载
- 《大学生创业实践》扫描版[高清PDF…
- 转图片格式的PDF软件
- 新电脑2013年第1~7期高清PDF下载
- C#技术分享【PDF转换成图片——11种方案】(转)