Project

General

Profile

PlantUML plugin PNG format doesn't work

Added by Hai Yang about 7 years ago

I'm using Redmine 3.4.2, and the latest PlantUML plugin. The PlantUML plugin supports both png and svg format.

However, the png format doesn't work. It shows hex string only. I checked background Redmine log, which shows the generated png file is 0 byte. The svg format works fine.

Is there anything wrong with my system? Thanks.


Replies (12)

RE: PlantUML plugin PNG format doesn't work - Added by Mauro Condarelli about 7 years ago

It works for me with the standard test:

{{plantuml(png)
  Bob -> Alice : hello
}}

in a wiki page.
This on a brand new install I'm testing right now.
I think You may be missing some png-related package.

RE: PlantUML plugin PNG format doesn't work - Added by Hai Yang about 7 years ago

I guess so. But I'm do not know which package is missed.

RE: PlantUML plugin PNG format doesn't work - Added by Mauro Condarelli about 7 years ago

I would try to use plantuml from the command line and see what happens.

PlantUML site (http://plantuml.com/starting) suggests something like: java -jar plantuml.jar sequenceDiagram.txt to produce sequenceDiagram.png.

You can try to get more information running with options: java -jar plantuml.jar -verbose -tpng -debugsvek sequenceDiagram.txt.

Other options that may be useful are -help and -testdot.

HiH!

RE: PlantUML plugin PNG format doesn't work - Added by Hai Yang about 7 years ago

The command runs well, and the generated png file is correct.

$ java -jar /var/plantuml/lib/plantuml.jar -verbose -tpng -debugsvek sequence.txt
(0.000 - 121 Mo) 117 Mo - PlantUML Version 1.2017.16
(0.003 - 121 Mo) 117 Mo - GraphicsEnvironment.isHeadless() true
(0.003 - 121 Mo) 117 Mo - Forcing -Djava.awt.headless=true
(0.003 - 121 Mo) 117 Mo - java.awt.headless set as true
(0.054 - 121 Mo) 115 Mo - Setting current dir: .
(0.054 - 121 Mo) 115 Mo - Setting current dir: /var/lib/jenkins/test
(0.055 - 121 Mo) 115 Mo - Using default charset
(0.061 - 121 Mo) 115 Mo - Setting current dir: /var/lib/jenkins/test
(0.068 - 121 Mo) 115 Mo - Setting current dir: /var/lib/jenkins/test
(0.068 - 121 Mo) 115 Mo - Reading file: sequence.txt
(0.480 - 121 Mo) 110 Mo - Creating file: /var/lib/jenkins/test/sequence.png
(0.511 - 121 Mo) 103 Mo - Creating image 120x126
(0.537 - 121 Mo) 102 Mo - Ok for com.sun.imageio.plugins.png.PNGMetadata
(0.575 - 121 Mo) 101 Mo - File size : 2300
(0.576 - 121 Mo) 101 Mo - Number of image(s): 1

RE: PlantUML plugin PNG format doesn't work - Added by Hai Yang about 7 years ago

I feel something wrong with the plugin which doesn't send command to plantuml.jar correctly for png.

RE: PlantUML plugin PNG format doesn't work - Added by Mauro Condarelli about 7 years ago

If You followed instructions and you created the file /usr/bin/plantuml you can add a line to echo the parameters passed to it;
something like:

#!/bin/bash
echo >>/tmp/plantuml.log "/usr/bin/java -Djava.io.tmpdir=/var/tmp -Djava.awt.headless=true -jar /opt/plantuml/plantuml.jar ${@}" 
/usr/bin/java -Djava.io.tmpdir=/var/tmp -Djava.awt.headless=true -jar /opt/plantuml/plantuml.jar ${@}

More than this I can't say, as I'm not involved in plugin development (and I'm not a Ruby programmer).
Hope it Helps!

RE: PlantUML plugin PNG format doesn't work - Added by Hai Yang about 7 years ago

Thanks a lot for your suggestion. It looks the binary is not triggered by the plugin. I will check it further.

RE: PlantUML plugin PNG format doesn't work - Added by Hai Yang about 7 years ago

I got it working and here is the details, with PlantUML plugin tag v0.5.1.

1. This script works for svg, but not for png.
Bob -> Alice : hello

2. If I removed space between "Alice" and ":", as well as that between ":" and "hello", png works. This makes me thought svg works but png doesn't work. It looks png needs more strict requirement which should not have space in some specific position. I'm not sure anything wrong on my platform to have such issue.
Bob -> Alice:hello

3. In plantuml setting, no matter what binary I set, it always works. But if I leave it empty, the plugin doesn't work. I think it checks the binary location, but never use it.

RE: PlantUML plugin PNG format doesn't work - Added by Hai Yang about 7 years ago

This also works, if no space in "Bob->Alice", while keep spaces in "Alice : hello"

{{plantuml(png)
Bob->Alice : hello
}}

RE: PlantUML plugin PNG format doesn't work - Added by Hai Yang about 7 years ago

I feel the space is not handled properly for png case.

RE: PlantUML plugin PNG format doesn't work - Added by Mauro Condarelli about 7 years ago

I think You should file a new Issue at https://github.com/dkd/plantuml/issues.

    (1-12/12)