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

Setting PLANTUML_LIMIT_SIZE from outside #12

Open
timur-han opened this issue Jan 21, 2021 · 7 comments
Open

Setting PLANTUML_LIMIT_SIZE from outside #12

timur-han opened this issue Jan 21, 2021 · 7 comments

Comments

@timur-han
Copy link

Hi,

Thank you for the contribution.

I rely on https://github.com/confluence-publisher/confluence-publisher to publish the documents. This again uses the version 2.0.2 of this library. It is executed over maven.

Due to having large diagrams, I need to set PLANTUML_LIMIT_SIZE=8192. I tried to set it over the environment variables and as well over mvn install -DPLANTUML_LIMIT_SIZE=8192. Unfortunately, neither of them has helped so far.

Is there a way to set it from outside?

@robertpanzer
Copy link
Member

@pepijnve Do you have an idea how to set this?

@pepijnve
Copy link
Member

I wasn't aware this limit existed I'm afraid. I would have to read through the PlantUML source code as well to find this out. Maybe an environment variable?

@timur-han
Copy link
Author

Hi @pepijnve

Thanks for your reply.

Normally, it is set over an environment variable and described in FAQ:

PlantUML limits image width and height to 4096. There is a environment variable that you can set to override this limit: PLANTUML_LIMIT_SIZE. You have to define this variable before launching PlantUML, something like:

set PLANTUML_LIMIT_SIZE=8192

or

setenv PLANTUML_LIMIT_SIZE 8192

Another way is an option in the command line:

java -DPLANTUML_LIMIT_SIZE=8192 -jar /path/to/plantuml.jar ...

However, it did not have any in this case :(

@pepijnve
Copy link
Member

When asciidoctor-diagram is used in combination with JRuby, PlantUML runs in-process. It would expect it to pick up that system variable as well. Perhaps the read of that variable happens in a bit of code that's being bypassed by the diagram glue code. I'm not using the regular CLI entry point. I'll check in the source code.

@pepijnve
Copy link
Member

pepijnve commented Jan 22, 2021

The read happens here https://github.com/plantuml/plantuml/blob/0575e7cf08d4508639a214f97abcac258558dee9/src/net/sourceforge/plantuml/cucadiagram/dot/GraphvizUtils.java#L150
The getenv method first attempts to read a system property and falls back to an environment variable. This should work just fine in combination with JRuby. Asciidoctor running under MRI might not work correctly since PlantUML runs in a subprocess there and I'm not 100% sure if the environment variable will be inherited by the subprocess. The system variable will definitely not get passed on.

@pepijnve
Copy link
Member

The next diagram release will let you pass a size-limit block attribute or plantuml-size-limit document attribute to override this setting. That'll be much easier to control reliably than using env or sys variables.

@vgallegob
Copy link

is it possible to specify the size from the online editor? it's not enought for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants