当前位置:网站首页 > 编程语言 > 正文

pdfview怎么转换成ppt(pdfview怎么转换成图片)



1.1如何应用PDFRenderer系统实现将PDF文档转换为图片的应用示例1.1.1应用PDFRenderer系统实现将PDF文档转换为图片的应用示例

1、构建示例测试Java应用程序项目

(1)在MyEclipse开发工具创建一个项目名称为JavaPDFApp的Java应用程序项目

(2)设置项目名称为JavaPDFApp

(3)项目结果

(1)启动项目的属性菜单

(2)切换到Java Build Path页中的Libraries选项页

(3)将下载的PDFRenderer系统文件加入到项目的编译环境中

3、在MyEclipse开发工具中创建示例程序类

(1)示例程序类名称为PDFToImagePictureByPDFRenderer,程序包名称为

com.bluedream.pdfrenderer

(2)将创建出PDFToImagePictureByPDFRenderer程序类的初始代码

4、编程PDFToImagePictureByPDFRenderer程序类的功能实现代码(1)编程PDFToImagePictureByPDFRenderer程序类中的功能方法

(2)PDFToImagePictureByPDFRenderer程序类的完整代码示例package com.bluedream.pdfrenderer;

import java.awt.Image;

import java.awt.Rectangle;

import java.awt.image.BufferedImage;

import java.io.File;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

import java.io.RandomAccessFile;

import ng.reflect.Method;

import java.nio.MappedByteBuffer;

import java.nio.channels.FileChannel;

import java.security.AccessController;

import java.security.PrivilegedAction;

import java.util.UUID;

import com.sun.image.codec.jpeg.ImageFormatException;

import com.sun.image.codec.jpeg.JPEGCodec;

import com.sun.image.codec.jpeg.JPEGEncodeParam;

import com.sun.image.codec.jpeg.JPEGImageEncoder;

import com.sun.pdfview.PDFFile;

import com.sun.pdfview.PDFPage;

public class PDFToImagePictureByPDFRenderer {

public PDFToImagePictureByPDFRenderer() {

super();

}

/

*

* @param orignalPDTFileName 转换前的原始的PDF文件绝对路径和文件名称,比如String orignalPDTFileName ="D:\软件项目程序\Demo1\demo1.pdf";

* @param resultImagePathName 转换后的图片存储的目录路径名称(绝对路径),比如String resultImagePathName ="D:\软件项目程序\Demo1\result\";

* @param exePandParameters 图片清晰度(n>0.0且n<7.0),为PDF的放大参数,也就转换后的图片的尺寸为原始的PDF页尺寸的倍数,默认为1.0(与原始的PDF文件页尺

寸相同);<1.0为缩小,>1.0为放大

* @param isPDFFileDeleted 转换后是否要删除原始的PDF文件,=true 删除原始的PDF文件,=false 不删除原始的PDF文件

*/

public boolean doTransferPdfFileToPicture(String orignalPDTFileName, String resultImagePathName, float exePandParameters, boolean isPDFFileDeleted) {

RandomAccessFile oneRandomAccessFile =null;

MappedByteBuffer oneMappedByteBuffer =null;

PDFFile onePDFFile =null;

FileOutputStream oneFileOutputStream =null;

File orignalPDTFile =null;

JPEGImageEncoder oneJPEGImageEncoder = null;

JPEGEncodeParam oneJPEGEncodeParam = null;

FileChannel oneFileChannel = null;

/

* 最终转换是否成功的返回状态标志,=false 表示转换不成功,=true 表示转换成功*/

boolean isTransferOK =false;

orignalPDTFile = new File(orignalPDTFileName);

try{

try {

/

* 以随机方式读取原始的PDF文档,并创建出RandomAccessFile类的对象实例*/

oneRandomAccessFile = new RandomAccessFile(orignalPDTFile, "r");

} catch (FileNotFoundException e) {

/

* e.printStackTrace()是在标准错误输出流上打印整个Exception轨迹栈(会把

到此这篇pdfview怎么转换成ppt(pdfview怎么转换成图片)的文章就介绍到这了,更多相关内容请继续浏览下面的相关推荐文章,希望大家都能在编程的领域有一番成就!

版权声明


相关文章:

  • 公司阶级分层图表(公司阶级分层图表模板)2025-05-02 22:27:06
  • 手机wifi反复断开连接苹果(iphone wifi反复断开连接)2025-05-02 22:27:06
  • 速排小蚂蚁会员(速排小蚂蚁会员多少钱)2025-05-02 22:27:06
  • 华为机考刷题(华为机考刷题一般刷多久)2025-05-02 22:27:06
  • 民间游戏的分类不包括(民间游戏的分类不包括哪些)2025-05-02 22:27:06
  • 更换ip的加速器(更换IP的加速器)2025-05-02 22:27:06
  • ping回环地址得不到返回(本地回环地址ping不通)2025-05-02 22:27:06
  • 打开目录的命令(打开目录快捷键)2025-05-02 22:27:06
  • latex怎么编辑(latex怎么编辑表格)2025-05-02 22:27:06
  • win7虚拟机配置要求(win7虚拟机配置要求多少)2025-05-02 22:27:06
  • 全屏图片