This content has been marked as final.
Show 3 replies
-
1. Re: Save pdf into database using seam itext
cash1981 Aug 26, 2009 10:15 PM (in response to prajwal81)This is possible. You need to render the faces page. More information here
private byte[] createPDF(String path) { // String DATA_STORE = // "org.jboss.seam.document.documentStore.dataStore"; EmptyFacesContext emptyFacesContext = new EmptyFacesContext(); // Context conversation = Contexts.getConversationContext(); byte[] bytes = null; try { Renderer.instance().render(path + "/status/status_pdf.xh tml"); DocumentStore doc = DocumentStore.instance(); if (doc != null) { DocumentData data = doc.getDocumentData("1"); ByteArrayDocumentData byteData = null; if (data instanceof ByteArrayDocumentData) { byteData = (ByteArrayDocumentData) data; } else { throw new Exception("Couldnt get the byt es from the pdf document, unkown class " + data.getClass().getName()); } bytes = byteData.getData(); } } catch (Exception ex) { log.error("Error when trying to get the content of the p df in bytes with the message #0", ex.getMessage()); ex.printStackTrace(); } finally { emptyFacesContext.restore(); } return bytes; }
This is how we do it
-
2. Re: Save pdf into database using seam itext
ganjiprabhakar Mar 16, 2010 4:24 PM (in response to prajwal81)I've been trying to put this solution to work but has no luck so far as Render.instance().render(viewID) throws
java.lang.IllegalArgumentException: resource doesn't exist: tempTagReceiptPdf.xhtml
This PDF enabled xhtml file is available under
WebContent/pages/transactions/tempTagReceiptPdf.xhtmland used various ways to pass this view id but did not help.
Could you please tell me what I should pass view id for the above path. By the way the app name is EZPass
Thanks in advance.
-
3. Re: Save pdf into database using seam itext
abucs01 Sep 7, 2010 3:49 AM (in response to prajwal81)even i am getting same error can seam experts help this.???