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

Unable to force use of jdot #181

Closed
offbynull opened this Issue Mar 21, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@offbynull
Copy link

offbynull commented Mar 21, 2019

I see references online saying that you can force PlantUML to use its pure Java Graphviz implementation by putting in !pragma graphviz_dot jdot at the start of your markup, but it doesn't look like this is being parsed correctly anymore?

When I use the following code to render a graph, I get back an image complaining about a syntax error (using version 1.2019.3).

package com.mycompany.test;

import java.awt.Desktop;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import net.sourceforge.plantuml.SourceStringReader;

public class PlantUmlDotTest {

    public static void main(String[] args) throws IOException {
        String source = ""
                + "@startuml\n"
                + "!pragma graphviz_dot jdot\n"
                + "digraph foo {\n"
                + " PlantUML -> Dot [label=use];\n"
                + "}\n"
                + "@enduml";
        SourceStringReader reader = new SourceStringReader(source);

        Path pngPath = Files.createTempFile("", ".png");
        try (OutputStream pngOs = Files.newOutputStream(pngPath)) {
            reader.outputImage(pngOs);
            Desktop.getDesktop().edit(pngPath.toFile());
        }
    }
}

http://www.plantuml.com/plantuml/uml/SoWkIImgAStDuL8iA4fCpqrKI2zABCWeowoAJyalKSW24bmfcM0nXRJyV8LgBeM0dCIyab1V7mLTEmKNe9hedCIar1pRqkBKM6kkMYw7rBmKe7a0

If I remove the pragma, I get back an image saying that there's an issue with the dot/graphviz installation (I don't have a native one installed). How do I force plantuml to use jdot to generate my graph?

@arnaudroques

This comment has been minimized.

Copy link
Contributor

arnaudroques commented Mar 22, 2019

This cannot work.

We did not fully port dot/graphviz to java.
We only port the part that we use to generate PlantUML diagrams.
Our port is not able to parse regular .dot files (digraph)

Sorry about that !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.