web stats
Mirth Community - View Single Post - Get PDF inside BLOB data from DB
View Single Post
Old 02-12-2010, 02:50 AM
alan alan is offline
Mirth Newb
Join Date: Feb 2010
Location: Modena, Italy
Posts: 8
alan is on a distinguished road
Default Get PDF inside BLOB data from DB

Hi, I'm trying to read a blob data ("image" type from sql server database) which contains a pdf... the code is:

var dbConn = DatabaseConnectionFactory.createDatabaseConnection (Utils.DbDriver, Utils.DbName, Utils.DbUser, Utils.DbPass);

var query =
"FROM GelabDevel.dbo.RFC_Events " +
"WHERE Id = '" + $('EventId').toString() + "'";

var result = dbConn.executeCachedQuery(query);


try {
var pdf = result.getBlob('PDF');

var strOut = new java.lang.StringBuffer();
var aux = new java.lang.String();

var br = new java.io.BufferedReader(pdf.getCharacterStream());

while ((aux = br.readLine())!= null)

} catch (ex) {
channelMap.put('ex', ex.toString());

It gives me the exception "TypeError: Cannot find function getCharacterStream". What am I missing? I really need to get the stream of this data, since the pdf is encrypted and i need to xor from char to char before send him.

Help would be very appreciated, thanks
Reply With Quote