2 Sep 2008 01:15
Re: Help required regarding showing pdf from blob data.
Richard Yee <ryee <at> cruzio.com>
2008-09-01 23:15:37 GMT
2008-09-01 23:15:37 GMT
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)
RSS Feed