Richard Yee | 2 Sep 01:15 2008
Picon

Re: Help required regarding showing pdf from blob data.

Ananth,
You aren't storing PDF data into your blob. You are storing a String. 
You need to store a PDF in order to retrieve a PDF.
You should use a PDF library to construct a PDF file.

The error you are getting is caused by the fact that you are writing a 
String that you retrieved from the database to a file with a .pdf 
extension. The Adobe Acrobat Reader attempts to read the file as a PDF 
but fails because the file isn't in PDF format.

-Richard

Ananth.Majumdar <at> cognizant.com wrote:
>
> Hi,
>
> We are using Ibatis with Spring in our project. We have requirement to 
> store pdf files in the database as blob columns and retrieve them and 
> show them again as pdf. Currently we are doing the following.
>
> 1. We are converting the pdf file into a byte array and saving it as a 
> blob column
>
> 2. While retrieving we are reading the blob column as a byte array
>
> 3. While converting the byte array to pdf, we are facing encoding 
> problems. A pdf file is generated and data is written into it, but 
> when we try to open it says ‘Cannot open because it is not a supported 
> file type or the file has been damaged’.
>
(Continue reading)

tomasz brymora | 2 Sep 03:01 2008
Picon

Re: Help required regarding showing pdf from blob data.

... I don't know if it will help, but look the iText library
http://www.lowagie.com/iText/
(but you probably knew about already)

--- On Mon, 9/1/08, Richard Yee <ryee <at> cruzio.com> wrote:

> From: Richard Yee <ryee <at> cruzio.com>
> Subject: Re: Help required regarding showing pdf from blob data.
> To: user-java <at> ibatis.apache.org
> Date: Monday, September 1, 2008, 7:15 PM
> Ananth,
> You aren't storing PDF data into your blob. You are
> storing a String. 
> You need to store a PDF in order to retrieve a PDF.
> You should use a PDF library to construct a PDF file.
> 
> The error you are getting is caused by the fact that you
> are writing a 
> String that you retrieved from the database to a file with
> a .pdf 
> extension. The Adobe Acrobat Reader attempts to read the
> file as a PDF 
> but fails because the file isn't in PDF format.
> 
> -Richard
> 
> 
> Ananth.Majumdar <at> cognizant.com wrote:
> >
> > Hi,
(Continue reading)


Gmane