ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Dynamically Creating PDFs in a Web Application
Subject:   Dynamic pdf to image display on webpage
Date:   2008-04-21 22:40:22
From:   touchpdf
Response to: Dynamic pdf to image display on webpage

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....