Unable to open ADF file once downloaded with FileDownloadActionListener.
840491Feb 17 2011 — edited Feb 18 2011Hello Friends,
I have developed an application in which there is one command button and on click of that I am trying to download PDF file. File is getting downloaded successfully but when I am trying to open that file, it
s giving me an error something like "could not open file.pdf beacuse either not supported or file has been damaged."
In JSF this is what I have written :
<af:commandButton text="Download" id="cb1">
<af:fileDownloadActionListener filename="Download.pdf"
contentType="application/pdf"
method="#{SampleBean.downloadPDF}"/>
</af:commandButton>
In my Bean I ve written something like this :
public class SampleBean {
public SampleBean() {
}
public void downloadPDF(FacesContext facesContext,
OutputStream outputStream) throws IOException {
OutputStreamWriter w = new OutputStreamWriter(outputStream, "UTF-8");
w.write("Hi there!");
w.flush();
}
}
FileDownloadActionListener does not support PDF formate?
I dont know where I am getting wrong or missing something. Any help or suggestion is appriciated.
Thanks in advance !! :)
cheers,
Sheetal.