01: package com.canoo.webtest.plugins.pdftest.htmlunit.pdfbox;
02:
03: import org.pdfbox.pdmodel.font.PDFont;
04:
05: import com.canoo.webtest.plugins.pdftest.htmlunit.PDFFont;
06:
07: /**
08: * Implementation of {@link PDFFont} based on PDFBox.
09: * @author Marc Guillemot
10: */
11: public class PDFBoxPDFFont implements PDFFont {
12: private final PDFont font_;
13: private int page_;
14:
15: public PDFBoxPDFFont(final PDFont font, final int page) {
16: if (font == null)
17: throw new NullPointerException("Font can't be null!");
18: font_ = font;
19: page_ = page;
20: }
21:
22: public String getName() {
23: return getWrappedFont().getBaseFont();
24: }
25:
26: public String getType() {
27: return getWrappedFont().getSubType();
28: }
29:
30: /**
31: * Gets the real font object wrapped by this instance
32: * @return the wrapped font
33: */
34: public PDFont getWrappedFont() {
35: return font_;
36: }
37:
38: public int getPage() {
39: return page_;
40: }
41:
42: public String toString() {
43: return "PDFBoxPDFFont[name=" + getName() + ", type="
44: + getType() + ", page=" + getPage() + "]";
45: }
46: }
|