0

I am using iText to generate PDF and is working fine, and I can also download it via browser as PDF. However, is it possible for java or iText to convert it to JPEG or any IMAGE file and allow users to download the image file.

response.setContentType("application/pdf; charset=utf-8");

Merely changing the contentType to image/jpg is not possible. I am continuously looking for answer but struggling to find one.

Any idea would be a lot of help

Blachshma
  • 17,097
  • 4
  • 58
  • 72
Victor Soto
  • 234
  • 3
  • 12
  • This has some solutions which might help: http://stackoverflow.com/questions/4886042/pdf-to-image-using-java – jcern Jan 08 '13 at 02:10

2 Answers2

0

I dont know more about iText. But using PDFBox we can convert pdf document into images. After splitting you can push images to response.

Here some reference links :

http://pdfbox.apache.org/commandlineutilities/PDFToImage.html

Converting a PDF into multiple JPGs with iText or other

http://www.javatpoint.com/example-to-display-image-using-servlet

Community
  • 1
  • 1
SANN3
  • 9,459
  • 6
  • 61
  • 97
0

you can use iText only for generating a pdf nothing else. see the link http://itextpdf.com/itext.php . see this to convert a pdf to image. See this link as well for clearer understanding with an example.

Nagarajan S R
  • 1,418
  • 2
  • 19
  • 31