# Issues

Issue #21 resolved

# Include PlantUML in pdf document shows images very large

Anonymous created an issue

Few use case and actors can fill a whole page. The solution could be add a parameters to let the user specify a scale for the includegraphics latex command? Just a suggestion. Marco

1. let the user specify a scale for the includegraphics

Hmm, it might be nice if we can specify parameters like image directive.

FWIW, plantuml_latex_output_format and PlantUML's skin parameter can change the rendering of PDF output.

• `plantuml_latex_output_format = 'pdf'` generates PDF image instead of PNG (yet supported by release version)
• `plantuml = 'java -jar plantuml.jar -SdefaultFontSize=8'` changes the default font size (for details, see http://plantuml.sourceforge.net/skinparam.html)

Yes image directive can be usefuill, however consider that actually image size is acceptable for html out but not for pdf, because of this I suggest a way to control the includegraphic statement. I'm already using pdf output. I gave a try also to defaultFontName but as result I got a graph almost the same size but with font very small compared with actor dimensions. BTW: sphinx with plantUML is the tool I have looked for along many years!!!

I forgot to sign the preceeding post. 8-) Mar

My 2 cents follows. This way you can use the directive :includegraphics: scale=1, width=... etc

Best regard, Mar

```diff -r 14db1e6b4f01 plantuml/sphinxcontrib/plantuml.py
--- a/plantuml/sphinxcontrib/plantuml.py	Fri Nov 25 08:54:30 2011 +0100
+++ b/plantuml/sphinxcontrib/plantuml.py	Sat Dec 03 11:29:05 2011 +0100
@@ -37,12 +37,17 @@
Alice <- Bob: Hi
"""
has_content = True
-    option_spec = {'alt': directives.unchanged}
+    option_spec = {'alt': directives.unchanged, 'includegraphics': directives.unchanged}

def run(self):
node = plantuml()
node['uml'] = '\n'.join(self.content)
node['alt'] = self.options.get('alt', None)
+        node['includegraphics'] = self.options.get('includegraphics', None)
+        if node['includegraphics'] is None:
+            node['includegraphics'] = ''
+        else:
+            node['includegraphics'] = '[' + node['includegraphics'] + ']'
return [node]

def generate_name(self, node, fileformat):
@@ -198,7 +203,7 @@
except PlantUmlError, err:
self.builder.warn(str(err))
raise nodes.SkipNode
-    self.body.append('\n\\includegraphics{%s}\n' % self.encode(refname))
+    self.body.append('\n\\includegraphics%s{%s}\n' % (node['includegraphics'], self.encode(refname)))
raise nodes.SkipNode

def pdf_visit_plantuml(self, node):

```

Mar's patch still works, but I would love for this to be included by default!

Which latex option is necessary? `width=` and `height=` ?

I want to avoid bare `:includegraphics:` because no other sphinx extensions implement it in that way.

width, height and/or scale would be awesome.

bonus but completely unecessary would be to make it captioned like a figure and alignable.

Sorry for the immense delay, but the patch works great! I mostly use scale or just the width.

What is the effect of using a unitless number? I was unable to percieve any difference with the values I chose (35 and 90).

Thanks, I'll finish up the patch later.

What is the effect of using a unitless number?

The doc says it is pixel, and ignored by LaTeX writer.

Any update on this? No hurry, just curious on the status.