Women in Technology

Hear us Roar



Article:
  Dynamically Creating PDFs in a Web Application
Subject:   Dynamic pdf to image display on webpage
Date:   2008-03-12 08:01:31
From:   Jyro
Hi everyone, seriously need some help here please. I'm trying to generate a pdf, convert it to an image, and display the image on the webpage - all dynamically. Is there a way this can be done using method 2 above (i.e. in memory). I tried using method 1 and I'm having problems - the pdf is created in filesystem, but when I try to convert the .pdf file to a .jpg file (with some other pdf-to-image converter API), the .pdf file is not accessible - seems to be locked somehow until the webpage that created it has been closed. So I'm thinking of doing everything in memory, but don't know how. Any suggestions, help of any kind is highly, highly appreciated :) thanks.
Full Threads Oldest First

Showing messages 1 through 1 of 1.

  • Dynamic pdf to image display on webpage
    2008-04-21 22:40:22  touchpdf [View]

    did you close the PDF file upon creation completion? it should be ok using another API to convert it(it just need readonly operation,am I right?)

    I use itext to generate PDF file in memory, and PDF-renderer to convert PDF to image, you can take a look at http://www.touchpdf.com.

    for example, I needed to concatenate serveral PDF files from DB:

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfCopyFields copy = new PdfCopyFields(baos);
    ..................................
    copy.addDocument(.....);
    copy.close();

    byte[] finalPdf = baos.toByteArray();

    then you can persist finalPdf to DB or serve it to browser directly....