aboutsummaryrefslogtreecommitdiff
path: root/stamper/stmp-itext/src/main
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-11-27 10:05:17 +0100
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2013-11-27 10:05:17 +0100
commitf3476576c50efd922593c82656efda7aec5ae97f (patch)
tree66107d5c5d3a88af66bd4829d8fcecc5678b749e /stamper/stmp-itext/src/main
parent7b2e2b640b0f392183f7927f692936950d3fabfc (diff)
downloadpdf-as-4-f3476576c50efd922593c82656efda7aec5ae97f.tar.gz
pdf-as-4-f3476576c50efd922593c82656efda7aec5ae97f.tar.bz2
pdf-as-4-f3476576c50efd922593c82656efda7aec5ae97f.zip
MOA integration sign/verification (not finished yet ...)
Lots of PDF-AS Web implementation
Diffstat (limited to 'stamper/stmp-itext/src/main')
-rw-r--r--stamper/stmp-itext/src/main/java/META-INF/MANIFEST.MF3
-rw-r--r--stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextStamper.java51
2 files changed, 29 insertions, 25 deletions
diff --git a/stamper/stmp-itext/src/main/java/META-INF/MANIFEST.MF b/stamper/stmp-itext/src/main/java/META-INF/MANIFEST.MF
new file mode 100644
index 00000000..5e949512
--- /dev/null
+++ b/stamper/stmp-itext/src/main/java/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextStamper.java b/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextStamper.java
index 5c0fb7df..ff68dcd8 100644
--- a/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextStamper.java
+++ b/stamper/stmp-itext/src/main/java/at/gv/egiz/pdfas/stmp/itext/ITextStamper.java
@@ -111,7 +111,9 @@ public class ITextStamper implements IPDFStamper {
/**
* Map the font definitions to IText's font statements
*/
- private static HashMap<String, Integer> fontMap_ = new HashMap<String, Integer>();
+ private static HashMap<String, Integer> fontStyleMap_ = new HashMap<String, Integer>();
+
+ private static HashMap<String, Font> fontMap_ = new HashMap<String, Font>();
static {
initStyleMaps();
@@ -129,16 +131,17 @@ public class ITextStamper implements IPDFStamper {
alignMap_.put(Style.LEFT, new Integer(Element.ALIGN_LEFT));
alignMap_.put(Style.CENTER, new Integer(Element.ALIGN_CENTER));
alignMap_.put(Style.RIGHT, new Integer(Element.ALIGN_RIGHT));
-
- fontMap_.put(Style.HELVETICA, new Integer(Font.HELVETICA));
- fontMap_.put(Style.TIMES_ROMAN, new Integer(Font.TIMES_ROMAN));
- fontMap_.put(Style.COURIER, new Integer(Font.COURIER));
- fontMap_.put(Style.NORMAL, new Integer(Font.NORMAL));
- fontMap_.put(Style.BOLD, new Integer(Font.BOLD));
- fontMap_.put(Style.ITALIC, new Integer(Font.ITALIC));
- fontMap_.put(Style.BOLDITALIC, new Integer(Font.BOLDITALIC));
- fontMap_.put(Style.UNDERLINE, new Integer(Font.UNDERLINE));
- fontMap_.put(Style.STRIKETHRU, new Integer(Font.STRIKETHRU));
+
+ //BaseFont.createFont()
+ fontStyleMap_.put(Style.HELVETICA, new Integer(Font.HELVETICA));
+ fontStyleMap_.put(Style.TIMES_ROMAN, new Integer(Font.TIMES_ROMAN));
+ fontStyleMap_.put(Style.COURIER, new Integer(Font.COURIER));
+ fontStyleMap_.put(Style.NORMAL, new Integer(Font.NORMAL));
+ fontStyleMap_.put(Style.BOLD, new Integer(Font.BOLD));
+ fontStyleMap_.put(Style.ITALIC, new Integer(Font.ITALIC));
+ fontStyleMap_.put(Style.BOLDITALIC, new Integer(Font.BOLDITALIC));
+ fontStyleMap_.put(Style.UNDERLINE, new Integer(Font.UNDERLINE));
+ fontStyleMap_.put(Style.STRIKETHRU, new Integer(Font.STRIKETHRU));
}
/**
@@ -225,26 +228,24 @@ public class ITextStamper implements IPDFStamper {
}
logger.debug("TrueType Font detected:"+fontName +" ("+fontSize+")");
- //try {
-
- Font font = new Font(fontMap_.get(fontString));
- //Font font = (Font) fontMap_.get(fontString);
+ try {
+ Font font = (Font) fontMap_.get(fontString);
// TODO: implement FONT resources via settings path!
- /*if (font == null) {
+ if (font == null) {
logger.debug("Font \"" + fontString + "\" not in cache. Instantiating font.");
- String fontPath = SettingsReader.RESOURCES_PATH + "fonts" + File.separator + fontName;
+ String fontPath = this.settings.getWorkingDirectory() + File.separator + "fonts" + File.separator + fontName;
logger.debug("Instantiating \"" + fontPath + "\".");
font = new Font(BaseFont.createFont(fontPath, BaseFont.WINANSI, true), fontSize);
fontMap_.put(fontString, font);
- } */
+ }
return font;
- // } catch (DocumentException e) {
- // throw new PdfAsException(e.getMessage());
- //} catch (IOException e) {
- // throw new PdfAsException(e.getMessage());
- //}
+ } catch (DocumentException e) {
+ throw new PdfAsException(e.getMessage());
+ } catch (IOException e) {
+ throw new PdfAsException(e.getMessage());
+ }
}
@@ -272,12 +273,12 @@ public class ITextStamper implements IPDFStamper {
{
return font;
}
- Object font_face = fontMap_.get(font_arr[0]);
+ Object font_face = fontStyleMap_.get(font_arr[0]);
if (font_face == null)
{
return font;
}
- Object font_weight = fontMap_.get(font_arr[2]);
+ Object font_weight = fontStyleMap_.get(font_arr[2]);
if (font_weight == null)
{
return font;