Fixed #1816 PDF export - leaking temporary files when frame has embedded texts

This commit is contained in:
Jindra Petřík
2022-11-02 09:07:28 +01:00
parent 22c5e67a74
commit 55da491678
3 changed files with 10 additions and 2 deletions

View File

@@ -646,7 +646,7 @@ public class DualPdfGraphics2D extends Graphics2D implements BlendModeSetable, G
}
} else {
FontExporter fe = new FontExporter();
File tempFile;
File tempFile = null;
try {
tempFile = File.createTempFile("ffdec_font_export_", ".ttf");
fe.exportFont(font, FontExportMode.TTF, tempFile);
@@ -656,6 +656,9 @@ public class DualPdfGraphics2D extends Graphics2D implements BlendModeSetable, G
} catch (IOException ex) {
Logger.getLogger(FrameExporter.class.getName()).log(Level.SEVERE, null, ex);
}
if (tempFile != null && tempFile.exists()) {
tempFile.delete();
}
}
}

View File

@@ -589,7 +589,7 @@ public class FrameExporter {
}
} else {
FontExporter fe = new FontExporter();
File tempFile;
File tempFile = null;
try {
tempFile = File.createTempFile("ffdec_font_export_", ".ttf");
fe.exportFont(font, FontExportMode.TTF, tempFile);
@@ -599,6 +599,9 @@ public class FrameExporter {
} catch (IOException ex) {
Logger.getLogger(FrameExporter.class.getName()).log(Level.SEVERE, null, ex);
}
if (tempFile != null && tempFile.exists()) {
tempFile.delete();
}
}
}