ref: 17553ce3f38ea54a68da3cb2f2f12e97fdbfc032
parent: 7049e2397d6a0c0343068e3cc61e6b955311c64a
author: Ali Gholami Rudi <ali@rudi.ir>
date: Thu Oct 26 15:44:32 EDT 2017
out: links to named destinations
--- a/out.c
+++ b/out.c
@@ -338,10 +338,12 @@
if (!lnk[0] || (nspec = sscanf(spec, "%d %d", &hwid, &vwid)) != 2)
return;
o_flush();
- if (isdigit((unsigned char) lnk[0])) {
- outf("[ /Rect [ %d %d t %d %d t ] /Page %s"
+ if (lnk[0] == '#' || isdigit((unsigned char) lnk[0])) {
+ outf("[ /Rect [ %d %d t %d %d t ] %s%s"
"/Subtype /Link /LNK pdfmark\n",
- o_h, o_v, o_h + hwid, o_v + vwid, lnk);
+ o_h, o_v, o_h + hwid, o_v + vwid,
+ lnk[0] == '#' ? "/Dest /" : "/Page ",
+ lnk[0] == '#' ? lnk + 1 : lnk);
} else {
outf("[ /Rect [ %d %d t %d %d t ]"
"/Action << /Subtype /URI /URI (%s) >> /Open true "