BrownBot Logo BrownBot Head

Rivalea (QAF) South Africa Division Xmas Party

10:23 pm Filed under: Nerd Alert

Everyone else is having work Christmas parties left right and centre and with Max around at his Oumas, I figured it was time for the official Rivalea South Africa division office Christmas party!

IMG_4714

Nerd Alert – Don’t Cross the Streams

3:43 pm Filed under: Nerd Alert

I’ve started a new blog category “Nerd Alert” for tech stuff that isn’t handy enough to go in the code lib but might be interesting to some of the readership, the rest of you can safely skim over them and avoid the mind numbing techno babble.

I’ve always been a little suss on streams, today my suspicions were justified as I struck this weird one today.

I was putting the finishing touches on my webservice hack to send Reporting Services reports via our archaic faxing software DBFax, pressure testing it with a run of half a dozen faxes including a multi page one.

For the multi page faxes, I have to access a frame in the TIFF file returned by reporting services, here is where I ran into an interesting little problem.

The following code works for a single page image but not a multi:

 

byte[] result = QAFRSReport.GetRSReport("/Feedmill Administration/RCTI", parameters);             MemoryStream s = new MemoryStream(result);             Image img = Image.FromStream(s);             s.Close();              int pageCount = QAFImageHelper.SavePages(img, fileName);

 

Note the closing of the stream assuming it was done with, I was wrong, sure it works fine for one page but trying to access a second page/frame in the img within the static method throws up a GDI+ error.

Moving the close down below the “SavePages” function fixed it, something to think about next time your playing around with streams.

Powered by WordPress