PlantUml.Net is a .Net wrapper for PlantUml
Add to your project via NuGet.
var factory = new RendererFactory();
var renderer = factory.CreateRenderer(new PlantUmlSettings());
var bytes = await renderer.RenderAsync("Bob -> Alice : Hello", OutputFormat.Png);
File.WriteAllBytes("out.png", bytes);
PlantUml.Net can render in 2 modes, Local and Remote.
Remote rendering mode uses the PlantUml hosted service to render diagrams.
You can also spin your own PlantUml server using docker.
docker run -d -p 8080:8080 plantuml/plantuml-server:jetty
Now you can use the remote rendering with http://localhost:8080 as url.
Local rendering mode uses a local copy of PlantUml to render diagrams.
Install Java. Ensure that the JAVA_HOME environment variable is set.
Download PlantUml.
By default PlantUml.Net looks for plantuml.jar
in the woring directory; you can specify an alternate location in PlantUmlSettings
.
GraphViz Dot is required for Local rendering mode of any diagram other than sequence.
Install GraphViz Dot You may need to set the GRAPHVIZ_DOT environment variable
see the PlantUml documentation for more detailed instructions.