use of com.axelor.apps.crm.db.Catalog in project axelor-open-suite by axelor.
the class CatalogController method showPdf.
public void showPdf(ActionRequest request, ActionResponse response) {
try {
Catalog catalog = Beans.get(CatalogRepository.class).find(request.getContext().asType(Catalog.class).getId());
MetaFile pdf = catalog.getPdfFile();
String title = catalog.getName();
Path path = MetaFiles.getPath(pdf.getFileName());
String fileLink = PdfTool.getFileLinkFromPdfFile(PdfTool.printCopiesToFile(path.toFile(), 1), title + ".pdf");
response.setView(ActionView.define(title).add("html", fileLink).map());
} catch (Exception e) {
TraceBackService.trace(e);
}
}
Aggregations