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 |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/de/uhilger/wbx/web/AdocServlet.java b/src/de/uhilger/wbx/web/AdocServlet.java
index 4ee14f7..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);
       }
     }
@@ -127,11 +128,14 @@
   private void transform(String fileName, String backend) {    
     Map<String, Object> attributes;
     File outFile = new File(fileName);
+    String thisDirName = outFile.getParent();
     File pdfStyles = new File(outFile.getParentFile(), "custom-theme.yml");
     if(pdfStyles.exists()) {
       attributes = attributes()
-              .attribute("pdf-themesdir", outFile.getParent())
+              .attribute("pdf-themesdir", thisDirName)
               .attribute("pdf-theme","custom")
+              .attribute("pdf-fontsdir", thisDirName + "/fonts")
+              .attribute("allow-uri-read")
               .sourceHighlighter("highlightjs")
               .asMap();
     } else {

--
Gitblit v1.9.3