本文基于fontbox-2.0.12.jar、pdfbox-2.0.12.jar实现pdf文件转为图片
public String pdfParserImg(String pdfPath,String imgPath,String imgType) throws IOException{
File file = new File(imgPath);
if(file.exists()){
return "已存在";
}
InputStream byteInputStream = null;
FileInputStream inputStream =null;
ImageOutputStream imOut = null;
ByteArrayOutputStream bs = null;
FileOutputStream fops = null;
try {
inputStream = new FileInputStream(new File(pdfPath));
PDDocument document = PDDocument.load(inputStream);
PDFRenderer renderer= new PDFRenderer(document);
int pageCount = document.getNumberOfPages();
if (pageCount > 0) {
BufferedImage im