Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-5754

PDF conversion in this format is very slow. Is there any room for optimization?

    XMLWordPrintableJSON

Details

    Description

      pdf: image2.pdf

      demo:

      public static void main(String[] args) throws IOException, InterruptedException {
      		File file = new File("D:\\fcs\\test\\test6\\image2.pdf");
      
      		final PDDocument load = PDDocument.load(file, MemoryUsageSetting.setupTempFileOnly()
      				.setTempDir(new File("D:\\fcs\\test")));
      
      		try {
      			PDFRenderer renderer = new PDFRenderer(load);
      //			renderer.setSubsamplingAllowed(true);
      			int pageIndex = 0;
      			float scale = 2f;
      			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 (Throwable e){
      			e.printStackTrace();
      		}
      		Thread.sleep(6000000);
      	}
      

      Attachments

        1. image2.pdf
          663 kB
          liu

        Activity

          People

            tilman Tilman Hausherr
            lycheng liu
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: