lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

page link in PDF may lead to wrong page


From: ArnoldTheresius
Subject: page link in PDF may lead to wrong page
Date: Tue, 28 Apr 2015 01:03:12 -0700 (MST)

Hello,
if the first-page-number is different than 1, then the page-links in the PDF
(i.e. TOC, \page-link, \label & \page-ref) lead you to the wrong page.
E.g. first-page-number = 3; then a link to page 4 will lead you to the 4th
page, but this is page 6.
(done with Lilypond 2.18.2 on Windows, both Acrobat and SumatraPDF)

Example:
#(set-default-paper-size "a6")
\paper {
  first-page-number = 3
}
M = {
  \repeat unfold 70 c''1
  \bar "|."
}

\markuplist \table-of-contents
\markup \column {
  " "
  \page-link #3 "Page 3"
  \page-link #4 "Page 4"
  \page-link #5 "Page 5"
  \page-link #6 "Page 6"
  \page-link #7 "Page 7"
}
\pageBreak

\tocItem "Y"
\label #'Y
\score { \M \header { piece = "Y" } }

\tocItem "D"
\label #'D
\score { \M \header { piece = "D" } }

\pageBreak
\markup \column {
  \fill-line { \null "Index:" \null }
  \with-link #'D \fill-line {"D" \page-ref #'D "0" "?"}
  \with-link #'Y \fill-line {"Y" \page-ref #'Y "0" "?"}
}
%EndOfExample

As I did find find a way how to path the SCM files framework-ps.scm and
output-ps.scm
in order to correct it, this bug is not critical - but I did not test my
patch with multiple books
or multiple bookparts in the LY file.
This patch just defines a global variable to store the offset, stores there
the offset which
is calculated in procedure output-framework, and subtracts this offset in
procedure page-link:
FILE scm/framework-ps.scm (after use-modules):
+(define-public page-number-decrement 0)
 
 (define format ergonomic-simple-format)
FILE scm/framework-ps.scm (in definition of function output-framework):
          (port (ly:outputter-port outputter)))
+    (set! page-number-decrement page-number)
     (if (ly:get-option 'clip-systems)
FILE scm/output-ps.scm (in definition of function page-link):
       (ly:format "~a ~a currentpoint vector_add  ~a ~a currentpoint
vector_add ~a mark_page_link"
                  (car x)
                  (car y)
                  (cdr x)
                  (cdr y)
+                 (- page-no page-number-decrement))
-                 page-no)

P.S. I do not claim this patch is done in a good programming style.

ArnoldTheresius




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/page-link-in-PDF-may-lead-to-wrong-page-tp175534.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]