use of org.olat.core.gui.util.WindowControlMocker in project openolat by klemens.
the class ExportBinderAsPDFResource method prepareHtml.
private File prepareHtml() {
File outputDir = new File(WebappHelper.getTmpDir(), "pf" + UUID.randomUUID());
outputDir.mkdirs();
WindowControl mockwControl = new WindowControlMocker();
BinderOnePageController printCtrl;
if (selectedPage != null) {
printCtrl = new BinderOnePageController(ureq, mockwControl, selectedPage, ExtendedMediaRenderingHints.toPdf(), false);
} else {
printCtrl = new BinderOnePageController(ureq, mockwControl, binderRef, ExtendedMediaRenderingHints.toPdf(), false);
}
Component content = printCtrl.getInitialComponent();
String html = createResultHTML(content);
File indexHtml = new File(outputDir, "index.html");
exportCSSAndJs(outputDir);
html = exportMedia(html, outputDir);
try (OutputStream out = new FileOutputStream(indexHtml)) {
IOUtils.write(html, out, "UTF-8");
} catch (IOException e) {
log.error("", e);
}
printCtrl.dispose();
return outputDir;
}
Aggregations