From 6ee3134f2d4a4794498a44160090725207efc4a7 Mon Sep 17 00:00:00 2001 From: Erik Koopmans Date: Thu, 13 Apr 2017 10:15:08 -0400 Subject: [PATCH] Fix link positioning --- plugins/annotations.js | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/plugins/annotations.js b/plugins/annotations.js index 1512c319f..c6c2b8348 100644 --- a/plugins/annotations.js +++ b/plugins/annotations.js @@ -162,8 +162,7 @@ } } - //var pageHeight = this.internal.pageSize.height * this.internal.scaleFactor; - var rect = "/Rect [" + f2(anno.x * k) + " " + f2((pageHeight - anno.y) * k) + " " + f2(anno.x + anno.w * k) + " " + f2(pageHeight - (anno.y + anno.h) * k) + "] "; + var rect = "/Rect [" + f2(anno.x * k) + " " + f2((pageHeight - anno.y) * k) + " " + f2((anno.x + anno.w) * k) + " " + f2((pageHeight - (anno.y + anno.h)) * k) + "] "; var line = ''; if (anno.options.url) { @@ -239,23 +238,6 @@ }); }; - /** - * valid options - *
  • pageNumber or url [required] - *

    If pageNumber is specified, top and zoom may also be specified

    - */ - jsPDFAPI.link = function(x,y,w,h,options) { - 'use strict'; - this.annotationPlugin.annotations[this.internal.getCurrentPageInfo().pageNumber].push({ - x : x, - y : y, - w : w, - h : h, - options : options, - type : 'link' - }); - }; - /** * Currently only supports single line text. * Returns the width of the text/link @@ -263,7 +245,7 @@ jsPDFAPI.textWithLink = function(text,x,y,options) { 'use strict'; var width = this.getTextWidth(text); - var height = this.internal.getLineHeight(); + var height = this.internal.getLineHeight() / this.internal.scaleFactor; this.text(text, x, y); //TODO We really need the text baseline height to do this correctly. // Or ability to draw text on top, bottom, center, or baseline.