aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/knowcenter/wag/egov
diff options
context:
space:
mode:
authorpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-02-17 15:16:34 +0000
committerpdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-02-17 15:16:34 +0000
commit9aeff8ada5f67086f87f90aa9d61beb6194e93aa (patch)
treef1074e2cc91962a946a6213020ab2a10e597a103 /src/main/java/at/knowcenter/wag/egov
parente6a0ed04beb980b51b8099c06e3a376e2861c191 (diff)
downloadpdf-as-3-9aeff8ada5f67086f87f90aa9d61beb6194e93aa.tar.gz
pdf-as-3-9aeff8ada5f67086f87f90aa9d61beb6194e93aa.tar.bz2
pdf-as-3-9aeff8ada5f67086f87f90aa9d61beb6194e93aa.zip
fixed link overlay text pos
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@762 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main/java/at/knowcenter/wag/egov')
-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;
}