file extension when using @startuml filename

0 votes
asked Feb 10, 2017 in Wanted features by anonymous
Is there a way to automatically generate the file extension based on the output format?

I want to write

@startuml filename

and e.g. the parameter "-pdf" should lead to filename.pdf
while the parameter "-tpng" should lead to filename.png

2 Answers

0 votes
answered Feb 10, 2017 by Serge Wenger Work (7,840 points)


The "filename" of the file with the PalntUML code give the "filename".

If version.txt content is:

java -jar C:\PgmFiles\PlantUML\plantuml.jar -tpng version.txt 
generate version.png
java -jar C:\PgmFiles\PlantUML\plantuml.jar -tsvg version.txt
generate version.svg
0 votes
answered Feb 10, 2017 by plantuml (149,180 points)
Good suggestion, thanks!

So we've built a new beta

With this beta, if no file extension if given after the "@startuml filename", we add the corresponding one.

The only drawback to us is that it breaks somehow the compatibility. someone uses PlantUML today with "@startuml filename" without extension, he will have a slightly different result (because some extension will be added to the filename). However, since we do NOT append an extension if some is already present, we expected that this will impact very few people, because probably people are putting extension to filename.

Tell us if it's working for you!