Welcome to PlantUML Q&A, where you can ask questions and receive answers from other members of the community.

You can also submit new features request and vote for them.

Bug: Instruction on how to enable PDF support seems not to be correct anymore

+1 vote

1. Open http://plantuml.sourceforge.net/pdf.html and follow the instuctions:

 

$ ls
ant.jar                     commons-io-1.3.1.jar        xml-apis-ext-1.3.04.jar
avalon-framework-4.2.0.jar  commons-logging-1.0.4.jar   plantuml.jar                xmlgraphics-commons-1.4.jar
batik-all-1.7.jar           fop.jar                     test.plant
 
2. Create the pdf
 
$ java -jar plantuml.jar -pdf test.plant 
 
3. Receive the error:
 
java.lang.ClassNotFoundException: org.apache.batik.apps.rasterizer.SVGConverter
 
 
asked Jun 3, 2013 in bug by alexander.willner (190 points)

4 Answers

0 votes

This is a minimal example of this "bug": 

 

7z x batikAndFop.zip && \
echo -e "@startuml\nAlice -> Bob: Test\n@enduml" > diagram.txt && \
java -jar plantuml.jar -pdf diagram.txt
 
Based on http://plantuml.sourceforge.net/pdf.html this should work :/
answered Jul 26, 2013 by anonymous
+1 vote
I have the same issue on my win8 system. Also, downloading the suggested Batik and FOP jars manually does not solve the Problem.

I would like to use vector-format PlantUMLdiagrams in my LaTeX file - so an export to pdf files would be really usefull for me.
answered Dec 12, 2013 by anonymous
Is SVG (which is vector format) useable with LaTeX ?
Sadly not without conversion. Some compiler support the eps format, but not PDFLatex, which I'm using at the moment. I tried to convert eps to pdf in an additional step with the ps2pdf command line tool. But it somehow destroys the bounding box and adds some white borders  left of and above the diagram - despite using the "-dEPSCrop" parameter.

At the moment I'm stuck with exporting the diagrams as 300 dpi PNGs, which is okay but not ideal.
1. Export to svg format.
2. Download it.
3. Convert it using zamzar (http://www.zamzar.com/)

The result is perfect :)

(KrZ)
I opened a bug for a related EPS issue: http://plantuml.sourceforge.net/qa/?qa=1799/.
+1 vote

We have seen that shadowing is a issue for PDF export.
But you can disable it using:
skinparam shadowing false

Anyway, the class-not-found exception is another story.
We've just check it under windows, and the following example seems to work:
https://dl.dropboxusercontent.com/u/13064071/plantumlPDF.zip

Could you download it, and test it under a windows env, just to see if it's working.
(You have to rename the foo1bat.txt file into foo1.bat).

In our case, the test1.pdf file was correctly generated.
Tell us if what it give in your case,

Thanks
 

answered Apr 10, 2014 by plantuml (126,850 points)
Thanks. I can confirm that under OS X plantuml version 7999 can generate PDF files by using the command line: 'java -cp ~/path/to/libs/"*" net.sourceforge.plantuml.Run -Sshadowing=false -tpdf path/to/file.txt'. Even with the latest version of the libraries. So you might want to update the documentation at http://plantuml.sourceforge.net/pdf.html
@plantuml Please update the instructions (see last comment). I coudnt' make it work without specifying -cp
+2 votes

Although this is and old question, I post the solution for future reference:

  1. It is only required to include the additional JAR files in the classpath ("-cp *" if JAR files in the same directory). Since "-cp" is incomptible with the "-jar" option, the class "net.sourceforge.plantuml.Run" should be specified.
  2. Due to the shadowing issue, it is necessary to disable it using the "-Sshadowing=false" option.

For example, to run the GUI interface, using the PDF format ne next command can be used:

java -cp * net.sourceforge.plantuml.Run -Sshadowing=false -tpdf -gui

 

answered Jun 19, 2014 by anonymous
Thanks. Don't forget the quotes around "*".
That works for me.
All the files you need are in http://apache.cbox.biz/xmlgraphics/batik/binaries/batik-bin-1.9.zip:
batik-all-1.9.jar
fop-transcoder-allinone-2.2.jar
xml-apis-1.3.04.jar
xml-apis-ext-1.3.04.jar
xmlgraphics-commons-2.2.jar

The first time I get a bunch of warnings like this, but subsequent runs spare me this
Aug 16, 2017 12:36:35 PM org.apache.fop.fonts.truetype.OpenFont checkTTC
INFO: This is a TrueType collection file with 2 fonts
Support This Project Offer 250 Mo! Follow PlantUML on Twitter
...