From 03d627444dc1cacf70305c883d340224cae0958d Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 20 Feb 2009 03:53:24 +0000 Subject: [PATCH] [2617308] Add PDF_FONT_DIR system config parameter for pdf export --- base/src/org/adempiere/pdf/Document.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/base/src/org/adempiere/pdf/Document.java b/base/src/org/adempiere/pdf/Document.java index ff65b16b89..d89234d917 100644 --- a/base/src/org/adempiere/pdf/Document.java +++ b/base/src/org/adempiere/pdf/Document.java @@ -22,6 +22,7 @@ import java.io.FileOutputStream; import java.io.OutputStream; import org.adempiere.pdf.viewer.PDFViewerBean; +import org.compiere.model.MSysConfig; import com.lowagie.text.FontFactory; import com.lowagie.text.Rectangle; @@ -41,6 +42,8 @@ public class Document { FontFactory.registerDirectories(); } + private final static String PDF_FONT_DIR = "PDF_FONT_DIR"; + private static void writePDF(Pageable pageable, OutputStream output) { try { @@ -53,7 +56,19 @@ public class Document { document, output); writer.setPdfVersion(PdfWriter.VERSION_1_2); document.open(); - final DefaultFontMapper mapper = new DefaultFontMapper(); + final DefaultFontMapper mapper = new DefaultFontMapper(); + + //Elaine 2009/02/17 - load additional font from directory set in PDF_FONT_DIR of System Configurator + String pdfFontDir = MSysConfig.getValue(PDF_FONT_DIR, ""); + if(pdfFontDir != null && pdfFontDir.trim().length() > 0) + { + pdfFontDir = pdfFontDir.trim(); + File dir = new File(pdfFontDir); + if(dir.exists() && dir.isDirectory()) + mapper.insertDirectory(pdfFontDir); + } + // + final float w = (float) pf.getWidth(); final float h = (float) pf.getHeight(); final PdfContentByte cb = writer.getDirectContent();