Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When showing multiple marriages, they don't look nice and Links don't work in PDF's files. #531

Closed
elysch opened this issue Nov 19, 2024 · 42 comments
Labels
pre-release bug Issue with pre-release version of GVExport
Milestone

Comments

@elysch
Copy link

elysch commented Nov 19, 2024

Hi.

I've just saw that when multiple marriages are active, they doesn't look nice in the report:

MultipleMarriagesGVExport-20241119

I suggest adding a blank line with a "-" between each one.

Ely.

P.S.: I remember reporting the issue about the links on PDF's but don't see any issue active mentioning it that's why I add it here. (Sorry, don't want to annoy anybody)

@elysch
Copy link
Author

elysch commented Nov 19, 2024

I discovered another thing.

If each marriage has a "first image", only the first one is shown, instead of showing the first image of each marriage.

image

Ely

@Neriderc
Copy link
Owner

I've just saw that when multiple marriages are active, they doesn't look nice in the report:

Ah it seems when the first line is too long, it wraps to the next line but doesn't correctly move the second marriage down.

I'm not sure that the dash is necessary, though. The dash implies some sort of time period, like "John Smith, 1940-1999". I think a space between looks just fine. Thoughts?

mockup of family record with dash between two marriages

mockup of family record without dash

P.S.: I remember reporting the issue about the links on PDF's but don't see any issue active mentioning it that's why I add it here. (Sorry, don't want to annoy anybody)

Do you have Graphviz installed on the server? This is necessary for links in PDFs, and you can't use functionality that is only available with client-side generation (I think this is just photo shapes).

If each marriage has a "first image", only the first one is shown, instead of showing the first image of each marriage.

I'll have a look into this and see if I can fix it.

@elysch
Copy link
Author

elysch commented Nov 20, 2024

Wow... really fast answer!!!!

You're right... the dash is not needed at all.

The images I added to the issue come from the generated pdf.

Yes... I have Graphviz installed on sever and is active.

image

And the "links" setting is active.

image

The links work just fine in the browser, but not in the PDF file

@Neriderc
Copy link
Owner

Wow... really fast answer!!!!

I happened to be checking my emails when you created this issue 🙂

The links work just fine in the browser, but not in the PDF file

Interesting. The browser links are separate so aren't relevant to the PDF links, but it looks like it should be working. It is definitely working for me. Is this also disabled?
screenshot of option to change photo shape

@Neriderc Neriderc added this to the 2.1.23 milestone Nov 20, 2024
@Neriderc Neriderc added the pre-release bug Issue with pre-release version of GVExport label Nov 20, 2024
@elysch
Copy link
Author

elysch commented Nov 20, 2024

Yes, it has "No change".

image

Since it works for you... it makes it harder to debug :(

[xxxx@xxxx modules_v4]# rpm -qi graphviz-2.40.1-45.el8.x86_64
Name        : graphviz
Version     : 2.40.1
Release     : 45.el8
Architecture: x86_64
Install Date: Mon 01 Jul 2024 02:08:13 PM CST
Group       : Unspecified
Size        : 8258919
License     : EPL-1.0
Signature   : RSA/SHA256, Tue 05 Dec 2023 11:20:03 AM CST, Key ID 15af5dac6d745a60
Source RPM  : graphviz-2.40.1-45.el8.src.rpm
Build Date  : Tue 05 Dec 2023 11:00:24 AM CST
Build Host  : ord1-prod-x86build002.svc.aws.rockylinux.org
Relocations : (not relocatable)
Packager    : [email protected]
Vendor      : Rocky
URL         : http://www.graphviz.org/
Summary     : Graph Visualization Tools
Description :
A collection of tools for the manipulation and layout of graphs (as in nodes
and edges, not as in barcharts).
[xxxx@xxxx modules_v4]#

@elysch
Copy link
Author

elysch commented Nov 20, 2024

I can see a lot of lines like the following in the dot file:

I57 [ label=<<TABLE COLOR="#606060" BORDER="1" CELLBORDER="0" CELLPADDING="2" CELLSPACING="0" BGCOLOR="#fefefe" TARGET="_blank" HREF="https://...

Those links work ok when I directly copy them to the browser.

When the individual has an image, there is an additional HREF in the same line. The link looks like this (replaced the domain and part of the path with : XXX.XXX.XXX)

HREF="https://XXX.XXX.XXX/media-download?xref=M6&amp;fact_id=f55c3eee5dbf1783852f043e1e577750&amp;disposition=inline&amp;mark=0"

When I copy one of those links to the browser I get a webtrees message saying The parameter “disposition” is missing.

@Neriderc
Copy link
Owner

Neriderc commented Nov 20, 2024

I don't think the comment about disposition would be an issue, it's likely because the URL has the & encoded as &amp; but in real use it shouldn't be an issue. In any case, it should at least open something if clicked.

Here is one I've generated. It's in my dev environment so the link won't actually work, but when you open the PDF and click on a person it should open a browser window and try to go there. Does it work?

gvexport.pdf

You do seem to have a slightly older version of Graphviz installed. I'm running webtrees in a docker container, and if I run dpkg -s graphviz it tells me the version is Version: 2.42.2-7+deb12u1

For some reason I don't understand, if I run dot -v then it tells me dot - graphviz version 2.43.0 (0) which seems to imply the graphviz version is 2.43.0.

In either case, you're running 2.40.1 so perhaps this difference is the problem? Seems odd though, if it was working before.

@elysch
Copy link
Author

elysch commented Nov 21, 2024

Could you please send to me your .dot file an let me know the dot command parameters I should use?

Just to be sure.

In my pdf not even the mouse pointer changes when you move over a supposed to be link.

@Neriderc
Copy link
Owner

Here is my settings file which you should be able to load using the option in GVExport. The people will need to match someone in your tree (so you probably need to update the starting individual) but otherwise it should load ok:

gvetest - Settings.json

I can't upload the DOT here as it's an unsupported file type but here is the contents:

digraph WT_Graph {
ranksep="0.15 equally"
nodesep="0.15"
dpi="72"
mclimit="1"
rankdir="LR"
pagedir="LT"
bgcolor="#eeeeee"
splines="spline"
edge [ style=solid, arrowhead=normal, arrowtail=none];
node [ shape=plaintext font_size="10" fontname="Arial"];
X1 [ label=<<TABLE COLOR="#606060" BORDER="1" CELLBORDER="0" CELLPADDING="2" CELLSPACING="0" BGCOLOR="#fefefe" TARGET="_blank" HREF="http://192.168.1.100:8089/tree/gvetest/individual/X1/Joseph-Joe-BLOGGS"><TR><TD COLSPAN="6" CELLPADDING="2" BGCOLOR="#add8e6" PORT="nam" ></TD></TR><TR><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="40" HEIGHT="40" FIXEDSIZE="true" ALIGN="CENTER" VALIGN="MIDDLE"><IMG SCALE="true" SRC="/var/www/webtrees/app/../data/media/boy5.png" ALT="Joseph Joe BLOGGS"  /></TD><TD ALIGN="LEFT" BALIGN="LEFT"  TARGET="_BLANK" CELLPADDING="4" PORT="dat"><FONT COLOR="#333333" POINT-SIZE="12">Joseph "Joe" BLOGGS</FONT><BR /><FONT COLOR="#555555" POINT-SIZE="10">* 4 May 1944 </FONT><BR /><FONT COLOR="#555555" POINT-SIZE="10">† 7 March 2004 (Place, Death)</FONT> </TD><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="0" HEIGHT="40" FIXEDSIZE="true"></TD><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="0" HEIGHT="40" FIXEDSIZE="true"></TD><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="0" HEIGHT="40" FIXEDSIZE="true"></TD><TD CELLPADDING="10"></TD></TR></TABLE>>];
X40 [ label=<<TABLE COLOR="#606060" BORDER="1" CELLBORDER="0" CELLPADDING="2" CELLSPACING="0" BGCOLOR="#fefefe" TARGET="_blank" HREF="http://192.168.1.100:8089/tree/gvetest/individual/X40/Jane-Smith"><TR><TD COLSPAN="6" CELLPADDING="2" BGCOLOR="#ffb6c1" PORT="nam" ></TD></TR><TR><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="40" HEIGHT="40" FIXEDSIZE="true" ALIGN="CENTER" VALIGN="MIDDLE"><IMG SCALE="true" SRC="/var/www/webtrees/app/../data/media/girl1.png" ALT="Jane Smith"  /></TD><TD ALIGN="LEFT" BALIGN="LEFT"  TARGET="_BLANK" CELLPADDING="4" PORT="dat"><FONT COLOR="#333333" POINT-SIZE="12">Jane Smith</FONT><BR /><FONT COLOR="#555555" POINT-SIZE="10">* 2 August 1945 </FONT>  </TD><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="0" HEIGHT="40" FIXEDSIZE="true"></TD><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="0" HEIGHT="40" FIXEDSIZE="true"></TD><TD ROWSPAN="2" CELLPADDING="1" PORT="pic" WIDTH="0" HEIGHT="40" FIXEDSIZE="true"></TD><TD CELLPADDING="10"></TD></TR></TABLE>>];
X41 [ color="#606060",fillcolor="#ffffee", target="_blank" href="http://192.168.1.100:8089/tree/gvetest/family/X41/Joseph-Joe-BLOGGS-Jane-Smith", target="_blank",  shape=oval, style="filled", margin=0.01, label=<<TABLE border="0" CELLPADDING="5" CELLSPACING="0"><TR><TD><FONT COLOR="#555555" POINT-SIZE="10">∞  16 March 1967<BR /></FONT></TD></TR></TABLE>>];
X1 -> X41 [color="#555555", style="solid", arrowsize=0.3]
X40 -> X41 [color="#555555", style="solid", arrowsize=0.3]
}

@Neriderc
Copy link
Owner

Neriderc commented Nov 21, 2024

Could you please send to me your .dot file an let me know the dot command parameters I should use?

Oh sorry, you're gonna try manually running the command? Running this command works for me, and has the links:

dot -Tpdf -o new.pdf gvexport.dot

But this is done with a different version of Graphviz, on my computer not in the docker container with webtrees:
dot - graphviz version 9.0.0 (20230911.1827)

There are lots of warnings and the images fail because they aren't there, but the output otherwise works, and links work:
screen shot of GVExport diagram

@elysch
Copy link
Author

elysch commented Nov 21, 2024

In the new.pdf links doesn't work.
I don't get it. Something must have changed in the server. But I don't remember changing Graphviz.

Forget it, I'll try to upgrade or do something

Thank you for your time

@Neriderc
Copy link
Owner

Neriderc commented Nov 21, 2024

Are you familiar with docker? It would be interesting to know if it works for you in a webtrees docker container (which should be system agnostic and therefore work the same everywhere), but it can be a bit of a learning curve if you're not already familiar.

Alternatively, it is probably not too difficult to download a more recent version of Graphviz directly from their site. I'd be interested to know if you work it out!

@elysch
Copy link
Author

elysch commented Nov 21, 2024

I installed Graphviz CentOS 8 rpm's and now "dot -V" reports

dot - graphviz version 2.44.1 (20200629.0846)

The links are still missing. It's weird. Just in case I looked for any graphviz "config" file without success.

Before that, I tried more recent graphviz versions without success, culdn't install them since my server is kind of old.

About containers... I don't have an environment now, but I'll look for it also :) (Have you heard about litespeed conteiners?)

P.S. I'm thinking the links never worked in pdf's generated in this server. Maybe I mistakenly just tested them in the browser on this year... The newest GVexport report with working links I have is from 2017 :/ :(

@elysch
Copy link
Author

elysch commented Nov 21, 2024

By the way.

I'm not sure that the dash is necessary, though. The dash implies some sort of time period, like "John Smith, 1940-1999". I think a space between looks just fine.

Where did you add the needed newline?
Downloaded the last main branch and it still shows the marriages one after the other in the same line.

Tnx

@elysch
Copy link
Author

elysch commented Nov 21, 2024

What I've just found is that if I convert .dot to ps and then convert it using ghostscript's ps2pdf , the links do work, but apparently ghostscript doesn't support utf-8

dot -Tps2 -o new.ps /tmp/gvexport.dot

ps2pdf /tmp/new.ps /tmp/new2.pdf


When I try to generate a .ps file directly in GVExport module, It can't find any image. I get this kind of errors:

Warning: "data/media/XXXXXX.jpg" was not found as a file or as a shape library member
Error: No or improper image file="data/media/XXXXXX.jpg"

If I execute directly in the console the command shown at the beginning of the errors, it doesn't complain about the images not being there, but they are not shown in the PDF after ps2pdf.

:(

Cheers.

@Neriderc
Copy link
Owner

Neriderc commented Nov 21, 2024

About containers... I don't have an environment now, but I'll look for it also :) (Have you heard about litespeed conteiners?)

I hadn't, and it sounds like they were only announced a couple of months ago. It also sounds like it's designed for people that sell web hosting.

For containers hosting individual services (like webtrees), I think docker is already the defacto solution and it does a good job of it. I'm happy to help if you want some instructions on how to set up webtrees in a docker container.

P.S. I'm thinking the links never worked in pdf's generated in this server. Maybe I mistakenly just tested them in the browser on this year... The newest GVexport report with working links I have is from 2017 :/ :(

That's really interesting. If you ever work it out it would be good to understand why it isn't working.

Where did you add the needed newline? Downloaded the last main branch and it still shows the marriages one after the other in the same line.

Sorry, I haven't made this change yet. The screen shot was created by manually editing the DOT file, but I intend to make this change next.

What I've just found is that if I convert .dot to ps and then convert it using ghostscript's ps2pdf , the links do work, but apparently ghostscript doesn't support utf-8

Hmm that's a shame. I'm reading here that your method is the recommended way if your environment doesn't have the Cairo renderer. So that is something to test. Are you able to use the SVG output in GVExport? This specifically calls the Cairo renderer as it is needed for the pictures - but make sure you disable links first. The Cairo renderer doesn't support links in SVG so GVExport uses the browser if links are enabled.

@elysch
Copy link
Author

elysch commented Nov 21, 2024

Thank you for your offering about Dockers... Apparently I don't have enough ram at the moment.

The SVG file, without links option, was generated without a problem. I opened it in chrome browser and seems ok.

[xxxx@xxxx webtrees]# dot -v -Tpdf -o /tmp/new5.pdf /tmp/x.dot
dot - graphviz version 2.44.1 (20200629.0846)
Using render: cairo:cairo
Using device: pdf:cairo:cairo
libdir = "/usr/lib64/graphviz"
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
The plugin configuration file:
        /usr/lib64/graphviz/config6
                was successfully loaded.
    render      :  cairo dot dot_json fig json json0 map mp pic pov ps svg tk vml xdot xdot_json
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  bmp canon cmap cmapx cmapx_np dot dot_json eps fig gv ico imap imap_np ismap jpe jpeg jpg json json0 mp pdf pic plain plain-ext png pov ps ps2 svg svgz tif tiff tk vml vmlz x11 xdot xdot1.2 xdot1.4 xdot_json xlib
    loadimage   :  (lib) bmp eps gif ico jpe jpeg jpg pdf png ps svg
pack info:
  mode   undefined
  size   0
  flags  0
  margin 8
pack info:
  mode   node
  size   0
  flags  0
Warning: Illegal attribute ALT in <IMG> - ignored
Warning: No such file or directory while opening /var/www/webtrees/app/../data/media/boy5.png
Error: No or improper image file="/var/www/webtrees/app/../data/media/boy5.png"
fontname: "Arial" resolved to: (PangoCairoFcFont) "Nimbus Sans, Regular" /usr/share/fonts/urw-base35/NimbusSans-Regular.otf
Warning: fixed cell size with unspecified width or height
Warning: fixed cell size with unspecified width or height
Warning: fixed cell size with unspecified width or height
network simplex:  4 nodes 4 edges maxiter=2147483647 balance=2
network simplex: 4 nodes 4 edges 0 iter 0.00 sec
network simplex:  7 nodes 7 edges maxiter=2147483647 balance=2
network simplex: 7 nodes 7 edges 0 iter 0.00 sec
in label of node X1
Warning: Illegal attribute ALT in <IMG> - ignored

Apparently it is using cairo renderer.

Could you please execute the dot command with "-v" option when the links do work in order to compare the output with this one?

@Neriderc
Copy link
Owner

Sure, here you go:

$ dot -v -Tpdf -o new5.pdf gvexport.dot
dot - graphviz version 9.0.0 (20230911.1827)
Using render: cairo:cairo
Using device: pdf:cairo:cairo
libdir = "/lib64/graphviz"
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
The plugin configuration file:
	/lib64/graphviz/config6
		was successfully loaded.
    render	:  cairo dot dot_json fig json json0 lasi map mp pic pov ps svg tk xdot xdot_json
    layout	:  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout	:  textlayout
    device	:  canon cmap cmapx cmapx_np dot dot_json eps fig gv imap imap_np ismap json json0 kitty kittyz mp pdf pic plain plain-ext png pov ps ps2 svg svgz tk vt vt-24bit webp x11 xdot xdot1.2 xdot1.4 xdot_json xlib
    loadimage	:  (lib) eps gif jpe jpeg jpg pdf png ps svg webp
pack info:
  mode   undefined
  size   0
  flags  0
  margin 8
pack info:
  mode   node
  size   0
  flags  0
Warning: Illegal attribute ALT in <IMG> - ignored
Warning: No such file or directory while opening /var/www/webtrees/app/../data/media/boy5.png
Error: No or improper image file="/var/www/webtrees/app/../data/media/boy5.png"
fontname: "Arial" resolved to: (PangoCairoFcFont) "Liberation Sans, Regular" /usr/share/fonts/liberation-sans/LiberationSans-Regular.ttf
Warning: fixed cell size with unspecified width or height
Warning: fixed cell size with unspecified width or height
Warning: fixed cell size with unspecified width or height
network simplex:  4 nodes 4 edges maxiter=2147483647 balance=2
network simplex: 4 nodes 4 edges 0 iter 0.00 sec
network simplex:  7 nodes 7 edges maxiter=2147483647 balance=2
network simplex: 7 nodes 7 edges 0 iter 0.00 sec
in label of node X1
Warning: Illegal attribute ALT in <IMG> - ignored
Warning: No such file or directory while opening /var/www/webtrees/app/../data/media/girl1.png
Error: No or improper image file="/var/www/webtrees/app/../data/media/girl1.png"
Warning: fixed cell size with unspecified width or height
Warning: fixed cell size with unspecified width or height
Warning: fixed cell size with unspecified width or height
network simplex:  4 nodes 4 edges maxiter=2147483647 balance=2
network simplex: 4 nodes 4 edges 0 iter 0.00 sec
network simplex:  7 nodes 7 edges maxiter=2147483647 balance=2
network simplex: 7 nodes 7 edges 0 iter 0.00 sec
in label of node X40
network simplex:  3 nodes 2 edges maxiter=2147483647 balance=1
network simplex: 3 nodes 2 edges 0 iter 0.00 sec
Maxrank = 1, minrank = 0
mincross: pass 0 iter 0 trying 0 cur_cross 0 best_cross 0
mincross WT_Graph: 0 crossings, 0.00 secs.
network simplex:  5 nodes 5 edges maxiter=2147483647 balance=2
network simplex: 5 nodes 5 edges 0 iter 0.00 sec
routesplines: 2 edges, 6 boxes 0.00 sec
Using render: cairo:cairo
Using device: pdf:cairo:cairo
gvRenderJobs WT_Graph: 0.00 secs.

What do you have in your config file at /usr/lib64/graphviz/config6?

These appear to be the only important sections for this (the PDF generates fine with everything else commented out):

libgvplugin_dot_layout.so.6 dot_layout {
        layout {
                dot 0
        }
}

libgvplugin_pango.so.6 cairo {
        render {
                cairo 10
        }
        textlayout {
                textlayout 10
        }
        loadimage {
                png:cairo 1
                png:lasi 2
                png:ps 2
        }
        device {
                png:cairo 10
                ps:cairo -10
                eps:cairo -10
                pdf:cairo 10
                svg:cairo -10
        }
}

Is yours the same?

@elysch
Copy link
Author

elysch commented Nov 22, 2024

Well there's a difference

libgvplugin_pango.so.6 cairo {
        render {
                cairo 10
        }                                        
        textlayout {
                textlayout 10
        }
        loadimage {
                png:cairo 1
#FAILS          png:lasi 2
                png:ps 2
        }
        device {
                png:cairo 10
                ps:cairo -10
                eps:cairo -10
                pdf:cairo 10
                svg:cairo -10
        }
}
libgvplugin_poppler.so.6 poppler {
        loadimage {
                pdf:cairo 1
        }
}

I don't know what does png:lasi does, but I don't think it would be the problem

@Neriderc
Copy link
Owner

I agree, I don't think png:lasi would be related. So it's probably not the config. Might be the version?

What hardware are you running it on? Is it a SBC (raspberry pi, etc) or some other ARM device, an old desktop/laptop, or is a commercial VPS?

@Neriderc
Copy link
Owner

Where did you add the needed newline? Downloaded the last main branch and it still shows the marriages one after the other in the same line.

I've just merged the changes into the main branch, so you can check it out now 🙂. I've also fixed the issue with only one photo showing.

@elysch
Copy link
Author

elysch commented Nov 22, 2024

I've just merged the changes into the main branch, so you can check it out now 🙂. I've also fixed the issue with only one photo showing.

Thank you very much. I've already tested it. Looks great.

What hardware are you running it on? Is it a SBC (raspberry pi, etc) or some other ARM device, an old desktop/laptop, or is a commercial VPS?

I have a commercial VPS.

Just for testing I downloaded Graphviz 11 and 12 for windows 11. (No need to install it)

Downloaded a DOT file and converted it to PDF.

Beyond the missing images, with version 11 links didn't work and with the version 12 they did.

I guess some Graphviz versions simply don't handle well the links and others do. Bad luck for me

@Neriderc
Copy link
Owner

What's the VPS you're using? Is it ARM or x86? What's the specific OS version you're using? If you let me know the specific company and plan that would help.

If I can recreate your environment I might be able to help find the issue.

@elysch
Copy link
Author

elysch commented Nov 23, 2024

cat /etc/system-release
Rocky Linux release 8.10 (Green Obsidian)
uname -r
4.18.0-553.5.1.el8_10.x86_64

right now I don't remember the company. Sorry. I'll ask my brother tomorrow, I hope

@elysch
Copy link
Author

elysch commented Nov 23, 2024

I've just fount the Graphviz documentation for URL says:

URL
Hyperlinks incorporated into device-dependent output
type: escString, default:

At present, used in ps2, cmap, imap and svg formats. For all these formats, URLs can be attached to nodes, edges and clusters. URL attributes can also be attached to the root graph in ps2, cmap and imap formats. This serves as the base URL for relative URLs in the former, and as the default image map file in the latter.

It doesn't mention pdf. Maybe newer versions don't accept links in pdf's

Sounds odd, though

@Neriderc
Copy link
Owner

Neriderc commented Nov 24, 2024

It doesn't mention pdf. Maybe newer versions don't accept links in pdf's

We're actually using the "href" attribute in the HTML-like label, rather than directly on the node. Maybe that makes a difference.

I was just reading this in the PostScript part:

Note: The default PostScript renderer can only handle the Latin-1 character set. To get non-Latin-1 characters into PostScript output, use -Tps:cairo, assuming your version was built with the Cairo renderer.

Earlier you mentioned:

What I've just found is that if I convert .dot to ps and then convert it using ghostscript's ps2pdf , the links do work, but apparently ghostscript doesn't support utf-8

Maybe try using -Tps:cairo instead of -Tps2?

Edit: Ah nevermind, -Tps doesn't seem to support links, but does support the Cairo renderer for non-Latin-1 characters. -Tps2 supports links, but not the Cairo renderer 😮‍💨

@elysch
Copy link
Author

elysch commented Nov 24, 2024

Decided to just download the dot file from GVExport and try may windows versions of Graphviz. I placed this post asking for help.

Let's see if it shed some light.

@elysch
Copy link
Author

elysch commented Nov 24, 2024

Look. There's an option to colour the edges

@Neriderc
Copy link
Owner

Neriderc commented Nov 24, 2024

Look. There's an option to colour the edges

In Graphviz, "edges" refers to the lines between the "nodes". In our case, the arrows.

And we already have options to change the arrow colour. Under Appearance -> Diagram -> Diagram style -> Relationship arrow colour. There is also an option there to use colours based on the relationship (birth or other than birth).

I am realising as I write this that you are probably thinking of the option to use a random style, and perhaps the option to use random colours would be better?

@elysch
Copy link
Author

elysch commented Nov 25, 2024

Hello

I am realising as I write this that you are probably thinking of the option to use a random style, and perhaps the option to use random colours would be better?

Yes. Something like that.

I tried this one and liked it. There is no problem if you like other colors, ofcourse.

private function getLineColor(): string {
    static $last = 0;
    if ($last == 10) {
        $last = 0;
    }
    $last++;
    switch ($last) {
            case 1:
            default:
                $color = '#000000';
                break;
            case 2:
                $color = '#c0392b';
                break;
            case 3:
                $color = '#9b59b6';
                break;
            case 4:
                $color = '#2980b9';
                break;
            case 5:
                $color = '#1abc9c';
                break;
            case 6:
                $color = '#27ae60';
                break;
            case 7:
                $color = '#f1c40f';
                break;
            case 8:
                $color = '#e67e22';
                break;
            case 9:
                $color = '#616a6b';
                break;
            case 10:
                $color = '#34495e';
                break;
        }
        return $color;

image

(The "static" keyword makes the value to be kept between function calls, so it always takes the next color, in the order of the "swtich" structure)


By the way, steveroush made some recommendations about our dot generation. Here

One of them is about the port names. Now that we have more than one picture, each one should have a different name. Could be pic, picbirth, picdeath, picburial, picmarriage1, picmarriage2, etc

But those changes didn't fix my problem though.

[quote="steveroush, post:5, topic:2558"]
Here are some other suggestions separate from the image problem

  • Unless 72 dpi is important to this effort, just use the default of 96 dpi
  • mclimit default is 1. Why explicitly set it to 1?
  • the documentation says that pagedir is ignored unless page is set.
  • the port names all see to be pic. For a given node, the port names must be unique.
  • some of the cells have width=“0”. Though undocumented, a positive integer seems to be required.
    [/quote]

@elysch
Copy link
Author

elysch commented Nov 25, 2024

The width is defined as 0 in about line 716 of app/Person.php inside function function getFactImage(string $pid, bool $detailsExist, string $id) : string {

                } else {
                    // Blank cell zero width to keep the height right
                    $out .= "<TD ROWSPAN=\"2\" CELLPADDING=\"1\" PORT=\"pic_fi_$cntFI\" WIDTH=\"0\" HEIGHT=\"" . ($this->dot->settings["font_size"] * 4) . "\" FIXEDSIZE=\"true\"></TD>";
                }

@Neriderc
Copy link
Owner

I tried this one and liked it. There is no problem if you like other colors, ofcourse.

(The "static" keyword makes the value to be kept between function calls, so it always takes the next color, in the order of the "swtich" structure)

We don't really know where arrows are heading as we create them, so it may not make a difference deliberately doing one colour after the next or just using a random selection from an array. I'll have a play and see what works well.

By the way, steveroush made some recommendations about our dot generation. Here

One of them is about the port names. Now that we have more than one picture, each one should have a different name. Could be pic, picbirth, picdeath, picburial, picmarriage1, picmarriage2, etc

But those changes didn't fix my problem though.

[quote="steveroush, post:5, topic:2558"]
Here are some other suggestions separate from the image problem

  • Unless 72 dpi is important to this effort, just use the default of 96 dpi
  • mclimit default is 1. Why explicitly set it to 1?
  • the documentation says that pagedir is ignored unless page is set.
  • the port names all see to be pic. For a given node, the port names must be unique.
  • some of the cells have width=“0”. Though undocumented, a positive integer seems to be required.
    [/quote]

These are things that can be solved easily enough, but it would be good to first work out why your links don't work! Try making the changes manually and see if it fixes them. You could also try using a label attribute on a basic shape instead of our complicated HTML-like labels, and see if they work using that approach (we probably can't actually fix things like that, but it would be good to know if it does help).

@elysch
Copy link
Author

elysch commented Nov 26, 2024

Thank you very much for the patience and effort.

Just those changes didn't fix anything.

I'll try your other suggestions and let you know.

@elysch
Copy link
Author

elysch commented Nov 27, 2024

Just to let you know that steveroush suggested to open an issue, and there Matthew Fernandez
said "I think to troubleshoot this we’re going to need the referenced images."

I tried it removing the images from the .dot file and this time generated a pdf file with links working and all. Let's see what happens with the issue.

@Neriderc
Copy link
Owner

That's a big clue! Does it work generating from GVExport with all photo settings disabled?

@elysch
Copy link
Author

elysch commented Nov 28, 2024

Good question.

If I generate directly without images the pdf from gvexport using the Server's Graphviz 2.44.1 (20200629.0846) the links still don't work.

If I generate without images a dot file and then use Graphviz 12.2.0 on windows, the links do work.

@Neriderc
Copy link
Owner

Neriderc commented Dec 2, 2024

Hmm. it does seem to be related to the specific version then. If you manage to find and changes that allow it to work in the older version, please let me know! I'm happy to make changes if you work out what the issue is.

@elysch
Copy link
Author

elysch commented Dec 2, 2024

Maybe if we could remove the EXIF information on the JPG files could work... but then, I don't know if it's enough.

@Neriderc
Copy link
Owner

Neriderc commented Dec 3, 2024

I just had a read through the issue you filed.

It seems like there might be two issues. The later version installed on windows seems to have issues with the specific images you have, but it seems that this must be unrelated to your original issue. If you switch off images in GVExport and the links still don't work (in your Rocky Linux environment with Graphviz 2.44), then it must not be related to the images like you're seeing with Graphviz 12.

I don't think I can help much at the moment, I'll let your issue play out and see if you get a resolution from it.

@elysch elysch changed the title When showing multiple marriages, they doesn't look nice and Links doesn't work in PDF's files. When showing multiple marriages, they don't look nice and Links don't work in PDF's files. Dec 3, 2024
@Neriderc
Copy link
Owner

I'm going to close this for the moment if that's ok. The parts that can be resolved have gone in the 2.1.23 release, and I don't want to get mixed up with what is in which release.

If you get a resolution to this, I'd be interested to hear it. You can still reply when the issue is closed, and I'll be notified so I should see it. Alternatively you can also open a new issue if that is more appropriate.

@elysch
Copy link
Author

elysch commented Dec 11, 2024

It's ok.

The only missing thing is the random colored lines. Right?

I am realising as I write this that you are probably thinking of the option to use a random style, and perhaps the option to use random colours would be better?

I opened a new issue for this (Random colors in lines. #549)

@elysch
Copy link
Author

elysch commented Dec 11, 2024

As a final note, I discovered I can generate (download) the report in SVG format, and then convert it to pdf using an online service. This way, the links and images do work ok in the final PDF file.

BE AWARE: I don't know what does that service does with the uploaded files, I mean, I don't know if they gather it's contents for other uses (licit or illicit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pre-release bug Issue with pre-release version of GVExport
Projects
None yet
Development

No branches or pull requests

2 participants