From f2a70357272c7a2e61f724385e23b4c4fa2e69cb Mon Sep 17 00:00:00 2001 From: ulrich Date: Thu, 23 Jul 2020 13:09:13 +0000 Subject: [PATCH] In Arbeit: PDF Theme --- src/de/uhilger/wbx/web/AdocServlet.java | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/de/uhilger/wbx/web/AdocServlet.java b/src/de/uhilger/wbx/web/AdocServlet.java index 2b55c81..f89b21f 100644 --- a/src/de/uhilger/wbx/web/AdocServlet.java +++ b/src/de/uhilger/wbx/web/AdocServlet.java @@ -94,6 +94,7 @@ File pdffile = new File(adocfile.getParentFile(), fname + DOT + PDF); outfile = pdffile; // PDF soll zurueckgegeben werden if(!pdffile.exists() || adocfile.lastModified() > pdffile.lastModified()) { + response.setContentType("application/pdf"); transform(absname, PDF); } } @@ -125,9 +126,23 @@ * nach PDF transformiert werden soll */ private void transform(String fileName, String backend) { + Map<String, Object> attributes; File outFile = new File(fileName); - Map<String, Object> attributes = attributes().attribute("pdf-themesdir", outFile.getParent()).attribute("pdf-theme","test").sourceHighlighter("highlightjs") - .asMap(); + String thisDirName = outFile.getParent(); + File pdfStyles = new File(outFile.getParentFile(), "custom-theme.yml"); + if(pdfStyles.exists()) { + attributes = attributes() + .attribute("pdf-themesdir", thisDirName) + .attribute("pdf-theme","custom") + .attribute("pdf-fontsdir", thisDirName + "/fonts") + .attribute("allow-uri-read") + .sourceHighlighter("highlightjs") + .asMap(); + } else { + attributes = attributes() + .sourceHighlighter("highlightjs") + .asMap(); + } Map<String, Object> options; if(null != backend) { options = options().inPlace(false) -- Gitblit v1.9.3