From 06705460473fe1d911d29f264b9ac505d5111fbf Mon Sep 17 00:00:00 2001 From: Christian Maierhofer Date: Mon, 13 Jun 2016 13:17:30 +0200 Subject: Modified sig-block positioning to image-based --- .../pdfbox2/positioning/PositioningPageDrawer.java | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/PositioningPageDrawer.java (limited to 'pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/PositioningPageDrawer.java') diff --git a/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/PositioningPageDrawer.java b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/PositioningPageDrawer.java new file mode 100644 index 00000000..72c333b7 --- /dev/null +++ b/pdf-as-pdfbox-2/src/main/java/at/gv/egiz/pdfas/lib/impl/pdfbox2/positioning/PositioningPageDrawer.java @@ -0,0 +1,68 @@ +package at.gv.egiz.pdfas.lib.impl.pdfbox2.positioning; + +import java.awt.Color; +import java.awt.Paint; +import java.io.IOException; + +import org.apache.pdfbox.pdmodel.graphics.color.PDColor; +import org.apache.pdfbox.rendering.PageDrawer; +import org.apache.pdfbox.rendering.PageDrawerParameters; + +public class PositioningPageDrawer extends PageDrawer{ + + public PositioningPageDrawer(PageDrawerParameters parameters) + throws IOException { + super(parameters); + // TODO Auto-generated constructor stub + } + + private static final Color POSCOLOR = new Color(234, 14, 184, 211); + + @Override + protected Paint getPaint(PDColor color){ + return POSCOLOR; + } + +// @Override +// protected void showGlyph(Matrix textRenderingMatrix, PDFont font, int code, String unicode,Vector displacement) throws IOException{ +// // bbox in EM -> user units +// Shape bbox = new Rectangle2D.Float(0, 0, font.getWidth(code) / 1000, 1); +// AffineTransform at = textRenderingMatrix.createAffineTransform(); +// bbox = at.createTransformedShape(bbox); +// +// // save +// Graphics2D graphics = getGraphics(); +// +// // draw +// graphics.setClip(graphics.getDeviceConfiguration().getBounds()); +// graphics.setColor(POSCOLOR); +// graphics.setStroke(new BasicStroke(.5f)); +// graphics.draw(bbox); +// +// // restore +// } +// +// @Override +// public void fillPath(int windingRule) throws IOException +// { +// // bbox in user units +// Shape bbox = getLinePath().getBounds2D(); +// +// // draw path (note that getLinePath() is now reset) +// //super.fillPath(windingRule); +// +// // save +// Graphics2D graphics = getGraphics(); +// +// +// // draw +// graphics.setClip(graphics.getDeviceConfiguration().getBounds()); +// graphics.setColor(POSCOLOR); +// graphics.setStroke(new BasicStroke(.5f)); +// graphics.draw(bbox); +// +// } + + + +} -- cgit v1.2.3