aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
index a754b8e..859d2c0 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StructContentHelper.java
@@ -75,9 +75,9 @@ public class StructContentHelper implements StructContentWriter {
*/
private Rectangle tempMarkedPos = null;
/**
- * Position of the signature verify link overlay
+ * Cell position of the signature verify link overlay
*/
- private Rectangle verifyLinkPos = null;
+ private Rectangle verifyLinkCellPos = null;
/**
* Kids array (K) of the <code>StructTreeRoot</code>
@@ -410,7 +410,7 @@ public class StructContentHelper implements StructContentWriter {
* Implements {@link StructContentWriter#storeCurrentPosAsLink()}
*/
public void storeCurrentPosAsLink() {
- this.verifyLinkPos = new Rectangle(this.tempMarkedPos);
+ this.verifyLinkCellPos = new Rectangle(this.tempMarkedPos);
}
private Map tmpMap = new HashMap();
@@ -463,7 +463,7 @@ public class StructContentHelper implements StructContentWriter {
// iText "converts" 0.0f to an integer, therefore we cannot use 0, not nice...
//linkAnnot.put(PdfName.RECT, new PdfArray(new float[] {0.01f, 0.01f, 0.01f, 0.01f}));
// take cell pos as link pos
- linkAnnot.put(PdfName.RECT, new PdfArray(calcLinkPos(atp, this.verifyLinkPos)));
+ linkAnnot.put(PdfName.RECT, new PdfArray(calcLinkPos(atp)));
linkAnnot.put(PdfName.STRUCTPARENT, structParentNr);
linkAnnot.put(PdfName.SUBTYPE, PdfName.LINK);
@@ -472,25 +472,26 @@ public class StructContentHelper implements StructContentWriter {
}
- private PdfArray calcLinkPos(ActualTablePos atp, Rectangle pos) {
+ private PdfArray calcLinkPos(ActualTablePos atp) {
PdfArray res = new PdfArray();
- float downY = atp.y - atp.height + pos.getTop() - pos.getHeight();
-
- float startX = atp.x + pos.getLeft();
- float yLine = getPosMapVal("yLine");
- float lineHigh = getPosMapVal("maxSize");;
- float lineWidth = getPosMapVal("lineWidth");
- UrlInTextFinder finder = (UrlInTextFinder) this.linkPosMap.get("urlFinder");
-
- // maybe one could calc the link pos even more exactly with char with counting
- // but this should be close enough (see BidiLine.processLine and chung.getcharwith)
- float lineCorr = -2;
- float xCorr = 2;
- res.add(new PdfNumber(xCorr +startX + finder.calcLinkPosXStart(lineWidth)));
- res.add(new PdfNumber(downY + yLine + lineHigh + lineCorr));
- res.add(new PdfNumber(xCorr + startX + finder.calcLinkPosXEnd(lineWidth)));
- res.add(new PdfNumber(downY + yLine + lineCorr));
-
+
+ float downY = atp.y - atp.height;
+
+ float startX = atp.x + this.verifyLinkCellPos.getLeft();
+ float yLine = getPosMapVal("yLine");
+ float lineHigh = getPosMapVal("maxSize");
+ float lineWidth = getPosMapVal("lineWidth");
+ UrlInTextFinder finder = (UrlInTextFinder) this.linkPosMap.get("urlFinder");
+
+ // maybe one could calc the link pos even more exactly with char width counting
+ // but this should be close enough (see BidiLine.processLine and chunk.getcharwith)
+ float lineCorr = -2;
+ float xCorr = 5;
+ res.add(new PdfNumber(1 + startX + finder.calcLinkPosXStart(lineWidth)));
+ res.add(new PdfNumber(downY + yLine + lineHigh + lineCorr));
+ res.add(new PdfNumber(xCorr + startX + finder.calcLinkPosXEnd(lineWidth)));
+ res.add(new PdfNumber(downY + yLine + lineCorr));
+
return res;
}