You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (Jira)" <ji...@apache.org> on 2023/06/16 17:10:00 UTC

[jira] (PDFBOX-5622) Convert the same page,Why are temp files getting bigger and bigger

    [ https://issues.apache.org/jira/browse/PDFBOX-5622 ]


    Tilman Hausherr deleted comment on PDFBOX-5622:
    -----------------------------------------

was (Author: JIRAUSER297279):
sorry, already supplemented. 2.0.28


> Convert the same page,Why are temp files getting bigger and bigger
> ------------------------------------------------------------------
>
>                 Key: PDFBOX-5622
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5622
>             Project: PDFBox
>          Issue Type: Bug
>    Affects Versions: 2.0.28
>            Reporter: liu
>            Priority: Major
>         Attachments: screenshot-1.png, screenshot-2.png, 复杂cad-转图片耗时.pdf
>
>
> demo:
> {code:java}
> public static void main2(String[] args) throws IOException, InterruptedException {
> 		File file = new File("D:\\file/复杂cad-转图片耗时.pdf");
> 		final PDDocument load = PDDocument.load(file, MemoryUsageSetting.setupMixed(1048576)
> 				.setTempDir(new File("D:\\test")));
> 		for (int i = 0; i < 1000; i++) {
> 			PDFRenderer renderer = new PDFRenderer(load);
> 			int pageIndex = 6;
> 			float scale = 2f;
> 			try {
> 				BufferedImage bufferedImage = renderer.renderImage(pageIndex, scale, ImageType.RGB);
> 				FileOutputStream fos = null;
> 				try {
> 					fos = new FileOutputStream(new File("D:\\fcs\\test/test6/image" + pageIndex + ".jpg"));
> 					ImageIO.write(bufferedImage, "jpg", fos);
> 				} finally {
> 					if (fos != null) {
> 						fos.close();
> 					}
> 				}
> 			} catch (Exception e) {
> 				System.out.println(e);
> 			}
> 		}
> 	}
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org