How to get some binary data?
Posted on 2003-03-20
i have some code that converts HTML into a PDF format (binary) using our ActivePDF Server + Webgrabber software, here at work.
Works perfectly, etc.
Now that i'm converting my code from asp -> c#, i cannot do the following :-
(ERRORS) strTextBinary = objAPServer.GetBinaryImage( strFileName );
objAPServer is an instance of the ActivePDF Server class :-
eg. APServerNET.APServer objAPServer = null;
The error is that the GetBinaryImage() function returns a type 'object'.
So then i tried this ....
object test = null;
test = objAPServer.GetBinaryImage( strFileName );
compiled. but i still have NO IDEA how i can get the CONTENT of this object...
Why am i using GetBinaryImage then???
well, in my working (old/traditional) ASP code, this is what i did...
Response.BinaryWrite(objAPServer.GetBinaryImage( strFileName )
and becuase i'm now proigramming this in C#, i do not want to write anything to the screen/console, becuase this is all encapsualted in a class. i wish for the class to return a binary string instead - so the person who USES my class can have the raw binary data and do what they want with it -> ie. save to disk, display to page, etc.
any suggestions folks?