summaryrefslogtreecommitdiff
path: root/src/cairo.c
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2017-08-26 09:58:48 +0930
committerAdrian Johnson <ajohnson@redneon.com>2017-08-26 16:26:12 +0930
commitdf37baf7895ef9acc71f3627b22e7368c8af3ea1 (patch)
tree31a859c66d5b9ab393599d261900012c470cbf9d /src/cairo.c
parent74c6e3ae1d356e8bb4c7043cb9d3897c45cc0f79 (diff)
downloadcairo-df37baf7895ef9acc71f3627b22e7368c8af3ea1.tar.gz
pdf: fix link positions
Converting the link position from cairo to pdf coordinates requires the page height. Since the link may point to a different page, build an array of the height of each page and use the target page height for the conversion. Don't default to a [0,0] position if "pos" is not specified. PDF allows a null destination position to be specified which means don't change the position if the page is already displayed or show top left if switching to a different page. This is more useful default particularly for external files where the coordinates (which must be in PDF coordinates as we don't know the page height) of the top left corner may not be known.
Diffstat (limited to 'src/cairo.c')
-rw-r--r--src/cairo.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cairo.c b/src/cairo.c
index eb863efdb..49cdbcf60 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -193,7 +193,7 @@
* @page: An integer specifying the page number in the PDF file to link to.
*
* @pos: [optional] An array of two floats specifying the x,y position
- * on the page. Default is 0,0.
+ * on the page.
*
* An example of the link attributes to link to a page and x,y position:
* <programlisting>
@@ -227,8 +227,9 @@
*
* @page: An integer specifying the page number in the PDF file.
*
- * @pos: [optional] An array of two floats specifying the x,y position
- * on the page. Default is 0,0.
+ * @pos: [optional] An array of two floats specifying the x,y
+ * position on the page. Position coordinates in external files are in PDF
+ * coordinates (0,0 at bottom left).
*
* An example of the link attributes to PDF file:
* <programlisting>