texmacs-dev
[Top][All Lists]
Advanced

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

Re: [Texmacs-dev] Complete Re: adding pdf hyperlink support


From: Sam Liddicott
Subject: Re: [Texmacs-dev] Complete Re: adding pdf hyperlink support
Date: Wed, 13 Jul 2011 09:51:21 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.20pre) Gecko/20110712 Lightning/1.0b2 Lanikai/3.1.12pre

Hi Miguel - thanks for your comments and interest. Today I am able to give a more worthy response.

On 12/07/11 22:10, Miguel de Benito Delgado wrote:
Hi,

  I patched your code in, compiled and voilà, the nice red boxes are there around my links. Alas, clicking does nothing but highlight them. Maybe we have different Ghostscript versions?

Maybe your link target is on the same page?
Otherwise I have ghostscript 9.01 and use ps2pdf to make the PDF which I view with evince, but Foxit PDF reader also works.
What pdf viewer are you using?

I've read here [http://www.madepublic.com/rc.php?RCD_ID=15191] that one must know the number of the page one is jumping to, and add it with "/Page 7", say. Might this not solve the more-or-less-random-destinations problem?

You don't need to know the number of the page you are jumping to.

http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/pdf_creation_apis_and_specs/pdfmarkReference.pdf
Defining Named Destinations
Locations in PDF files can be specified by name instead of by page number and view. These
names can then be used as destinations of bookmarks or links. Using named destinations is
particularly advantageous for cross-document links, because if the document containing a
link’s destination is revised, the link will still work, regardless of whether its location in the
file has changed.

A named destination is specified by using the pdfmark operator in conjunction with the
name DEST. The syntax for a named destination pdfmark is:

[ /Dest name
/Page pagenum
/View destination
/DEST pdfmark

Dest name (Required) The destination’s name.
Page integer (Optional) The sequence number of the destination page. If present,
            the named destination pdfmark may be placed anywhere in the
           PostScript language file. If omitted, the pdfmark must occur within
          the PostScript language description for the destination page.

View array (Optional) The view to display on the destination page. If omitted,
          defaults to a null destination (lower left corner of the page at a
         zoom of 100%). See “Destinations” on page 44 for information on
            specifying a view destination.

As for the view, on page 45:

View
array
Specifies a link or bookmark’s destination on a page, and its fit type.
The first array entry is one of the fit type names shown in Table 3.5. The
remaining entries, if any, specify the location as either a rectangle, a
point, or an x– or y–coordinate, depending on the fit type.

we use XYZ with NULL as zoom so as not to change the zoom the user already has:

XYZ left top zoom
   left and top specify the distance from the origin of the page to the top-left
  corner of the window. zoom specifies the zoom factor, with 1 being 100%
 magnification. If left, top or zoom is NULL, the current value of that parameter is
retained. For example, specifying a view destination of
/View [/XYZ NULL NULL NULL]
goes to the specified page and retain the same horizontal and vertical offset
and zoom as the current page. A zoom of 0 has the same meaning as a zoom of
NULL.

Now left and top are the position of the rect being rendered at the label; here is a sample from one of my files:

[ /Dest(#footnr-2) cvn /View [/XYZ 363 2948 null] /DEST pdfmark

and here is the link to it:

[ /Dest(#footnote-2) cvn /Rect [ 363 2924 393 2887 ]
/Border [16 16 1 [3 10]] /Color [1 0 0] /Subtype /Link /ANN pdfmark

Please could you try this PDF and see if it works for you:
http://git.savannah.gnu.org/cgit/fangle.git/plain/fangle.pdf

GOOD NEWS - I note that links from the table-of-contents DO jump to the right part of the page! If the TOC entry is to a new section - that has the page-number at the bottom of the page instead of the top of the page, then I notice that evince takes me to the bottom of the page. If the TOC entry is to a subsection and the page number is shown at the top of the page, then evince takes me to the top of the page.

To see, try: http://git.savannah.gnu.org/cgit/fangle.git/plain/fangle.pdf and in the contents, click on "4 Using Fangle with Lyx ... 17" - it goes to the bottom of the page where the page 17 is. Then try "4.4 configuring the build script ... 19" and see that it goes to the top of the page. In both cases where the page number is printed.

In the .ps, the destination for configuring the build script is:

[ /Dest(#auto-18) cvn /View [/XYZ 108 4144 null] /DEST pdfmark

and the toc link is:

[ /Dest(#auto-18) cvn /Rect [ 3568 3296 3651 3243 ]
/Border [16 16 1 [3 10]] /Color [1 0 0] /Subtype /Link /ANN pdfmark

Hopefully that gives me enough clue to work out the problem why it doesn't position properly for other links.

But I'm very interested in your links not working at all, and would like to see the .ps and .pdf (and .tm file).

Sam



Regards,
________________
Miguel de  Benito.


On Mon, Jul 11, 2011 at 18:07, Sam Liddicott <address@hidden> wrote:

On 11/07/11 12:55, Philippe Joyez wrote:

Dear Sam,

I just tested your patch, and it's indeed pretty close to be working
perfectly. Like you said, the only frustrating part is that the pdf reader
doesn't jump exactly at the link, but nearby. Not always at the top of the
page by the way: some times in the middle, at the bottom, occasionnally
close to the dest but on the next page... It seems that the numbers for the
dest rect are off, for some reason. I guess you have already tried to
understand this wierdness.

As far as I can test, the latex hyperlink stuff displays the same behavior so I don't know if there is a solution.

Sam


_______________________________________________
Texmacs-dev mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/texmacs-dev

_______________________________________________ Texmacs-dev mailing list address@hidden https://lists.gnu.org/mailman/listinfo/texmacs-dev


--
[FSF
          Associate Member #2325]


reply via email to

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