private synchronized File writePdf(MutableDataSet options, File htmlFile) throws IOException { File root = getRoot(); CharSequence baseName = getName(); try (FileOutputStream out = new FileOutputStream(new File(root, baseName + ".pdf"))) { PdfConverterExtension.exportToPdf(out, FileUtils.readFileToString(htmlFile, "UTF-8"), htmlFile.getAbsoluteFile().toURI().toString(), options); } return new File(htmlFile.getPath().replaceAll("\\.html$", ".pdf")); }
/** * Gets report file. * * @return the report file */ @Nonnull public File getReportFile() { return new File(getRoot(), getName() + ".md"); }
/** * Gets report file. * * @return the report file */ @Nonnull public File getReportFile() { return new File(getRoot(), getName() + ".md"); }
private synchronized File writePdf(MutableDataSet options, File htmlFile) throws IOException { File root = getRoot(); CharSequence baseName = getName(); try (FileOutputStream out = new FileOutputStream(new File(root, baseName + ".pdf"))) { PdfConverterExtension.exportToPdf(out, FileUtils.readFileToString(htmlFile, "UTF-8"), htmlFile.getAbsoluteFile().toURI().toString(), options); } return new File(htmlFile.getPath().replaceAll("\\.html$", ".pdf")); }
@Override public void close() throws IOException { if (null != primaryOut) { primaryOut.close(); } try (@javax.annotation.Nonnull PrintWriter out = new PrintWriter(new FileOutputStream(getReportFile()))) { write(out); } File root = getRoot(); write(); writeZip(root, getName().toString()); onComplete.stream().forEach(fn -> { try { fn.run(); } catch (Throwable e) { log.info("Error closing log", e); } }); }
@Override public void close() throws IOException { if (null != primaryOut) { primaryOut.close(); } try (@javax.annotation.Nonnull PrintWriter out = new PrintWriter(new FileOutputStream(getReportFile()))) { write(out); } File root = getRoot(); write(); writeZip(root, getName().toString()); onComplete.stream().forEach(fn -> { try { fn.run(); } catch (Throwable e) { log.info("Error closing log", e); } }); }
try { write(); try (FileInputStream input = new FileInputStream(new File(getRoot(), getName() + ".html"))) { IOUtils.copy(input, out); try { write(); try (FileInputStream input = new FileInputStream(new File(getRoot(), getName() + ".pdf"))) { IOUtils.copy(input, out); onComplete(() -> { try { if (isAutobrowse()) Desktop.getDesktop().browse(new File(getRoot(), getName() + ".html").toURI()); } catch (IOException e) { throw new RuntimeException(e);
try { write(); try (FileInputStream input = new FileInputStream(new File(getRoot(), getName() + ".html"))) { IOUtils.copy(input, out); try { write(); try (FileInputStream input = new FileInputStream(new File(getRoot(), getName() + ".pdf"))) { IOUtils.copy(input, out); onComplete(() -> { try { if (isAutobrowse()) Desktop.getDesktop().browse(new File(getRoot(), getName() + ".html").toURI()); } catch (IOException e) { throw new RuntimeException(e);
private synchronized File writeHtml(MutableDataSet options) throws IOException { List<Extension> extensions = Arrays.asList( TablesExtension.create(), SubscriptExtension.create(), EscapedCharacterExtension.create() ); Parser parser = Parser.builder(options).extensions(extensions).build(); HtmlRenderer renderer = HtmlRenderer.builder(options).extensions(extensions).escapeHtml(false).indentSize(2).softBreak("\n").build(); String txt = toString(toc) + "\n\n" + toString(markdownData); FileUtils.write(new File(getRoot(), getName() + ".md"), txt, "UTF-8"); File htmlFile = new File(getRoot(), getName() + ".html"); String html = renderer.render(parser.parse(txt)); html = "<html><body>" + html + "</body></html>"; try (FileOutputStream out = new FileOutputStream(htmlFile)) { IOUtils.write(html, out, Charset.forName("UTF-8")); } log.info("Wrote " + htmlFile); // log.info("Wrote " + htmlFile); // return htmlFile; }
done.release(); responseHtml = getRead(); FileUtils.write(new File(log.getRoot(), id), responseHtml, "UTF-8"); } catch (IOException e) { throw new RuntimeException(e);
done.release(); responseHtml = getRead(); FileUtils.write(new File(log.getRoot(), id), responseHtml, "UTF-8"); } catch (IOException e) { throw new RuntimeException(e);
private synchronized File writeHtml(MutableDataSet options) throws IOException { List<Extension> extensions = Arrays.asList( TablesExtension.create(), SubscriptExtension.create(), EscapedCharacterExtension.create() ); Parser parser = Parser.builder(options).extensions(extensions).build(); HtmlRenderer renderer = HtmlRenderer.builder(options).extensions(extensions).escapeHtml(false).indentSize(2).softBreak("\n").build(); String txt = toString(toc) + "\n\n" + toString(markdownData); FileUtils.write(new File(getRoot(), getName() + ".md"), txt, "UTF-8"); File htmlFile = new File(getRoot(), getName() + ".html"); String html = renderer.render(parser.parse(txt)); html = "<html><body>" + html + "</body></html>"; try (FileOutputStream out = new FileOutputStream(htmlFile)) { IOUtils.write(html, out, Charset.forName("UTF-8")); } log.info("Wrote " + htmlFile); // log.info("Wrote " + htmlFile); // return htmlFile; }
MarkdownNotebookOutput outer = this; try { File root = getRoot(); File subreportFile = new File(root, reportName); MarkdownNotebookOutput subreport = new MarkdownNotebookOutput(subreportFile, -1, false) {
MarkdownNotebookOutput outer = this; try { File root = getRoot(); File subreportFile = new File(root, reportName); MarkdownNotebookOutput subreport = new MarkdownNotebookOutput(subreportFile, -1, false) {