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