I have a database that stores a pdf as binary data. I am creating dynamic server pages to allow users to view the data in the database. When they click on a link I want the binary data in the database to be retrieved and I want the user to see the actual image of the pdf instead of the binary data. Does anyone know how to transform binary data in a database to display the actual image in a dynamic server page?
You might want to refer to the classes at the following URL for converting the Binary data to .png or .jpeg images or of your choice using the ImageIO.
[url]JDK 19 Documentation - Home
My two cents, I think this particular requirement can be satisfied more easily using Java than webMethods.
Cheers,
Akshith
Converting a PDF to an image is not trivial. You’d need some pretty sophisticated libraries, which most likely are not free (I’ve not searched but in prior experience there aren’t free solutions).
I assume you probably just want to return the raw bytes from the DB to the browser. You can use setResponse along with setting specific headers to cause the browser to do the right thing (prompt the user to save the file or launch Adobe Reader). The content-disposition header is the key one. Search the web for info.
You might find this thread useful. [url]wmusers.com