# File lib/puppet/util/reference.rb, line 37
37:   def self.pdf(text)
38:     puts "creating pdf"
39:     Puppet::Util.secure_open("/tmp/puppetdoc.txt", "w") do |f|
40:       f.puts text
41:     end
42:     rst2latex = which('rst2latex') || which('rst2latex.py') || raise("Could not find rst2latex")
43:     cmd = %{#{rst2latex} /tmp/puppetdoc.txt > /tmp/puppetdoc.tex}
44:     Puppet::Util.secure_open("/tmp/puppetdoc.tex","w") do |f|
45:       # If we get here without an error, /tmp/puppetdoc.tex isn't a tricky cracker's symlink
46:     end
47:     output = %x{#{cmd}}
48:     unless $CHILD_STATUS == 0
49:       $stderr.puts "rst2latex failed"
50:       $stderr.puts output
51:       exit(1)
52:     end
53:     $stderr.puts output
54: 
55:     # Now convert to pdf
56:     Dir.chdir("/tmp") do
57:       %x{texi2pdf puppetdoc.tex >/dev/null 2>/dev/null}
58:     end
59: 
60:   end