|
|
|
@ -96,12 +96,16 @@ public class TempFileController {
|
|
|
|
|
*/
|
|
|
|
|
private void tryConvertPDF(FileEntity fileEntity) throws FileNotFoundException {
|
|
|
|
|
if (null != fileEntity) {
|
|
|
|
|
// 相对路径
|
|
|
|
|
String absoluteUrl = fileEntity.getAbsoluteUrl();
|
|
|
|
|
BufferedInputStream inputStream = FileUtil.getInputStream(absoluteUrl);
|
|
|
|
|
// 同名文件,多生成一个pdf文件
|
|
|
|
|
String pdfName = absoluteUrl.replaceAll("\\.[^\\.]+", ".pdf");
|
|
|
|
|
FileOutputStream outputStream = new FileOutputStream(pdfName);
|
|
|
|
|
// 根据类型来转换成为pdf
|
|
|
|
|
boolean convertedSuccess = PDFConverUtil.convertToPDFByFileNameSuffix(absoluteUrl, inputStream, outputStream);
|
|
|
|
|
if(convertedSuccess) {
|
|
|
|
|
// 转换成功,则返回给前端
|
|
|
|
|
fileEntity.set("cvPDFAbsoluteUrl", pdfName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|