| Author |
Problem with a4j mediaOutput to render pdf file
|
Kumar Gaurav
Ranch Hand
Joined: Apr 08, 2008
Posts: 108
|
|
Hi All,
I am using a4j:mediaoutput to render pdf but it ir throwing error "File does not begin with '%PDF-'".
Please find below the code i am using :
public void generatePdf(OutputStream out, Object object) {
WEBLOGGER.info("inside generatePdf method");
if (null !=out && null != object) {
WEBLOGGER.info("inside generatePdf method for pdf");
byte[] buf = getPdfBytes();
if (null != buf && buf.length > 0) {
try {
out.write(buf);
out.close();
out.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
<h:panelGroup id="wrapUpPdf">
<a4j:mediaOutput element="object" cacheable="false" session="false"
standby="Loading Pdf..." mimeType="application/pdf"
type="application/pdf" style="width: 711px;height: 985px"
createContent="#{orderProcessingBOCardBean.generatePdf}" />
</h:panelGroup>
Please suggest me as i am stuck.
|
Regards,
Gaurav
|
 |
Kumar Gaurav
Ranch Hand
Joined: Apr 08, 2008
Posts: 108
|
|
|
can any one please post any pointer in this regard.
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14456
|
|
|
I can't say anything for certain, but what I'd do would be put the code in a debugger and see what's being read into the buffer. In other words, see what "getPdfBytes" is actually giving to you.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
 |
|
|
subject: Problem with a4j mediaOutput to render pdf file
|
|
|