This commit is contained in:
jiangs 2025-09-30 14:58:28 +08:00
parent b23efa4fad
commit 30e08cf2d1

View File

@ -24,7 +24,6 @@ import com.itextpdf.kernel.pdf.PdfWriter;
import com.itextpdf.layout.Canvas; import com.itextpdf.layout.Canvas;
import com.itextpdf.layout.element.Image; import com.itextpdf.layout.element.Image;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.sf.jasperreports.engine.JREmptyDataSource;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -139,8 +138,11 @@ public class ReportUtil {
} }
//删除最后给前端的pdf文件 //删除最后给前端的pdf文件
File file = new File(outputPath); File file = new File(outputPath);
String data = Base64.encode(file); String data = "";
FileUtils.deleteFile(outputPath); if (file.exists()) {
data = Base64.encode(file);
FileUtils.deleteFile(outputPath);
}
return new Result("0", "打印成功!", data); return new Result("0", "打印成功!", data);
} else { } else {
return new Result("0", "打印成功!", httpPath); return new Result("0", "打印成功!", httpPath);