Method: Pdfcrowd::HtmlToPdfClient#convertStringToFile
- Defined in:
- lib/pdfcrowd.rb
#convertStringToFile(text, file_path) ⇒ Object
Convert a string and write the output to a file.
-
text- The string content to convert. The string must not be empty. -
file_path- The output file path. The string must not be empty.
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 |
# File 'lib/pdfcrowd.rb', line 882 def convertStringToFile(text, file_path) if (!(!file_path.nil? && !file_path.empty?)) raise Error.new(Pdfcrowd.(file_path, "convertStringToFile::file_path", "html-to-pdf", "The string must not be empty.", "convert_string_to_file"), 470); end output_file = open(file_path, "wb") begin convertStringToStream(text, output_file) output_file.close() rescue Error => why output_file.close() FileUtils.rm(file_path) raise end end |