How to add hyperlinks to date events in tree reports?

Using Gramps 5.1.3 on Linux.

Ancestor/relative events with dates like birth, marriage, death are sourced to (permalinked) URLs of publicly available in church registers, census records, and the like, in Gramps. Such URLs are stored as event notes.

In generating ancestry or descendant (pdf) reports I’d like the source URLs to be hyperlinked to the dates. The intent is when I share the pdf reports the report recipient can simply click on the dates and quickly view the relevant source material.

What’s the easiest way to achieve this? (I’m sufficiently well versed in python)

The sample reports where I found hyperlinks being generated only had Web file formats as output options. None of those offered PDF as an output option. Then I “Printed” a webpage to PDF and that did not preserve the hotlinks. The first thing to check is whether any of the PDF writing libraries used by Gramps are capable of being passed hyperlinks by existing reports with hyperlinks. That should be done before figuring out how to conjure hotlinks onto a field from your method of storing the URL.

But aside from that, the way you are associating URLs with data within the Gramps database seems a bit odd. Notes are free-form text and that seems like a fragile way to store URLs.

I do something similar except that I use Citations where the Page is the URL.

Some sources will have standard Permalink prefix strings. (Although the “Permanence” is questionable. One online source has changed the prefix 3 times in the last 5 years.) For ongoing maintenance reasons, I wanted to be able to edit the Prefix once instead of in every Citation. (Note that tools like the Isotammi PropertyEditor exist and would allow a mass Search & Replace. But updating dozens of Citations with a RegEx or Pattern search creates more potential failure points than directly editing a single record. And the mass updates also tweak the “Last Modified” timestamp on all those Citations. Which limits some of the Sorting value for those Citations.)

So, in these cases, my Source has the Prefix stored as an Attribute and the Citation Page stores their internal UID (Unique Identifier).

As an example, WikiTree as a (less than reliable) Source has a Prefix of “WikiTree: The Free Family Tree” and Sir Alec Guinness has a page UID of “De_Cuffe-1”. This concatenates to : “https://www.wikitree.com/wiki/De_Cuffe-1

I don’t want to stray afar from my original point of how to hyperlink URLs to dates in tree reports. Gramps can generate OpenDocument reports, which should be fully capable of containing hyperlinks. I don’t think that requires much programming logic, although I can be wrong on that.

I acknowledge there are various places and strategies where store source URLs in Gramps. In the “event editor” there is the “reference information” block, and there in the notes you can have a type “citation” where an URL is embedded.

If I read you correctly, the you store your citation URLs in the Event “Source Citation” block, but I believe that would be more appropriate for “XYZ Parish, Volume IX, folio 123” and the only way URLs can be embedded there is through notes.

If you run some tests, I think you fill find that at least some gramps reports (e.g. detailed descendant report) will export the link when you generate the report first to odt and then export the report to pdf (I reformat all my reports in LibreOffice before export to pdf so I can use standard preset styles, and various standard headers & footers).

As far as I can tell, it works even when the link is within the description of an event, not just within a note attached to the event and hyperlinked using the gramps link editor.

BUT, you may find that some of these links, while there is still an underlying hotlink, do not appear to the end user as being hotlinked. If they mouse over the URL for long enough, it does show the link, but its display on screen is sometimes indistinguishable from surrounding text.

I have not yet completed testing as to why the behaviour seems to be inconsistent, but I suspect gramps, or else the pdf export library used by LibreOffice, needs a whitespace before and after the URL to be able to reliably format it as different from surrounding text.

I think the main issue with some hotlinks not being formatted on the page so they look like hotlinks mainly affects those entered directly in the description field, and usually not those hotlinked within attached notes.

There is also the problem that your end user may be using yet another pdf viewer, which further complicates diagnosing what they may or may not see.

But I work on the principle that I hope my end users will be smart enough (if required) to copy and paste the (indistinguishable) URL text from my pdf, then paste it into their brower anyway!

Adrian,

Thanks for your response. Based on your response I placed URLs in the Event description fields, and generating a detailed descendant report to odt. The URLs did appear in that report successfully next to event dates.

That said, I’d appreciate if you can provide any pointers to help me figure out how to implement similar functionality in the graphical descendant/ancestor trees. The graphical trees, as currently implemented, do not contain any URLs/hyperlinks even if the Event descriptions fields are populated.

The graphical trees are a bit more conceptually more familiar to the target “lay” audience not involved in genealogical research than the Henry/D’Aboville/Register numbered detailed reports.

Thanks!

After I had sent my suggestion, I realised you possibly literally did mean (only) chart reports, not text ones.

I have no experience of hotlinks in any of the descendant/ancestor charts. But as far as I am aware there is no way within gramps, for the data that DOES show in one of the chart/tree reports (like the person’s name, or the date or place of major life events) to link to a URL

I strongly suspect the answer is that the only types of report for which is it possible to hotlink are those which output the description field, and/or any note attached to those events that are displayed.

The only other option is likely to be to do it manually. IF (and probably a big if) the charts you want involve a quite small and manageable number of people, you MIGHT be able output to SVG and then manually embed the hotlinks on the relevant text of the names or dates. Whether the link can easily be satisfactorily formatted so it looks like a hotlink, is another matter. I think you need to “wrap” each text or graphical object within the SVG code with an <a> element including the appropriate URL for that object.

I use the SVG output format extensively for reformatting chart output prior to distribution in PDF. For example, I have found it quite practical to manually edit scale, position, fonts, colours, lineweights etc in an ancestor chart of 8 generations, at a virtual page size of ~0.6m X 3.36m. But it would be pretty tedious adding the links!

You might also need to experiment whether the hotlink survives export from your SVG editor to PDF. (You can distribute as SVG, if security of your data is not an issue).

Hi Adrian,

The graphical ancestor/descendant trees in gramps have output to odt. In the past I’ve manually hyperlinked URLs to events in odt, but as you state, this is tedious (at least three key events/person, birth, marriage, & death). For even the least non-trivial family trees manual linking is impractical. From odt then print to pdf.

Automation is why we have computers and programs. I just need some guidance on which source code (modules) to look at first to implement this functionality. I may yet swallow my words but this shouldn’t be too difficult.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.