lilypond-devel
[Top][All Lists]

 From: Reinhold Kainhofer Subject: Re: PDF hyperlinks Date: Mon, 27 Dec 2010 15:34:05 +0100 User-agent: KMail/1.13.5 (Linux/2.6.35-23-generic; KDE/4.5.4; i686; ; )

Am Montag, 27. Dezember 2010, um 01:34:47 schrieb Dan Eble:
> The only mention I can find of PDF hyperlinks is for the point-and-click
> feature.

LilyPond also supports URL hyperlinks with the \with-url command. They are
written out to the intermediate .ps file as pdfmark and correctly converted to
PDF.

> I would like to create a PDF with page references

Internal links (to a particular position marked by a \label) are not supported
so far.

> Is that something that can be done in scheme?  If so, in which file and
> functions should I begin?

I don't think it can be done in Scheme alone. I don't think it would be too
hard, though. Basically, it can be done with pdfmark, too. For the
specification of the pdfmark Postscript extension see

What needs to be done is:

1) In the Postscript backend (scm/famework-ps.scm or scm/output-ps.scm)
written in Scheme:

-) Write out each \label as a named destination to the .ps file. The code is
[ /Dest /nameOfYourLabel /DEST pdfmark
and needs to be inserted on the page where the label was placed.

-) For the link, you also need to insert
[ /Rect [70 650 210 675]
/Dest /nameOfYourLabel
/ANN pdfmark
where the [70 650 210 675] specify the exact rectangle for the link.

2) Of course, the non-trivial part of all this is how to get the information
about label and link to the ps backend... I don't have a clear idea how to
propagate that information from the markup interpretation to the backend. It
might be able to do this in Scheme, but maybe also some C++ is required.
From a quick look at the code, all labels are collected in the label-page-
table variable of the paper object, but I don't know if this is available in
the backend...

In any case, this is a very good enhancement request, so bug squad, please
open a bug report (enhancement request) for this.

Cheers,
Reinhold

--
------------------------------------------------------------------