This content has been marked as final.
Show 1 reply
-
1. Re: a4j:mediaOutput to render pdf document
bolsover Dec 10, 2009 7:55 AM (in response to bolsover)OK - Sorted
A good nights sleep and upgrade to 3.3.2-SR1 from 3.3.1-GA solved this particular problem...<a4j:mediaOutput element="object" mimeType="application/pdf" classid="CLSID:CA8A9780-280D-11CF-A24D-444553540000" id="media" session="false" createContent="#{GenericDocumentBean.paint}" value="1" style="width:800px; height:600px;" cacheable="false" > </a4j:mediaOutput>
I'm actually retrieveing the .pdf from a database so in this code, document.getFdata() retrieves a varbinary(max) field from an SQL Server database via hibernate..public void paint(OutputStream stream, Object object) throws IOException, SQLException { SerializableBlob sblob = (SerializableBlob) document.getFdata(); Blob blob = sblob.getWrappedBlob(); InputStream inStream = blob.getBinaryStream(); int length = -1; byte[] buffer = new byte[4096]; while ((length = inStream.read(buffer)) != -1) { stream.write(buffer, 0, length); } }
My next issue - how to embed excel and word in a page - can it be done?