Is there a way to parameterize the value of the download attribute of the documentViewer ? I need to set it dynamically.
page:
Code: Select all
<p:dialog id="showReport" widgetVar="showReport" modal="true" resizable="true" dynamic="true">
<pe:documentViewer cache="true" id="pdfvisualizer" height="500" width="1200"
value="#{documentViewer.report}" zoom="page-width" download="parametrize-me-pls.pdf"/>
</p:dialog>
Code: Select all
@SessionScoped
public class DocumentViewerBean implements Serializable {
private static final long serialVersionUID = -565408561080994105L;
private StreamedContent report;
private String nameFile;
public synchronized void getReport(AnagReg reg) throws FileNotFoundException{
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
nameFile = "REG_" + reg.getId().toString() + "_" + sdf.format(new Date()) + ".pdf" ;
report = new RegDataReport().buildReportPdf(nameFile, reg);
}
public StreamedContent getReport() {
return report;
}
public void setReport(StreamedContent report) {
this.report = report;
}
public String getNameFile() {
return nameFile;
}
public void setNameFile(String nameFile) {
this.nameFile = nameFile;
}
}
Thank you for your availability.