lib/princely.rb
def pdf_from_string(string, output_file = '-')
    path = self.exe_path()
    # Don't spew errors to the standard out...and set up to take IO
    # as input and output
    path << ' --silent - -o -'

    # Show the command used...
    logger.info "\n\nPRINCE XML PDF COMMAND"
    logger.info path
    logger.info ''

    # Actually call the prince command, and pass the entire data stream back.
    pdf = IO.popen(path, "w+")
    pdf.puts(string)
    pdf.close_write
    result = pdf.gets(nil)
    pdf.close_read
    result.force_encoding('BINARY') if RUBY_VERSION >= "1.9"
    return result
  end
# Makes a pdf from a passed in string.
#
# Returns PDF as a stream, so we can use send_data to shoot
# it down the pipe using Rails.
#
Makes a pdf from a passed in string.
Returns PDF as a stream, so we can use send_data to shoot
it down the pipe using Rails.
Makes a pdf from a passed in string . Returns PDF as a stream so we can use send_data to shoot it down the pipe using Rails .
def pdf_from_string(string, output_file = '-')
    path = self.exe_path()
    path << ' --silent - -o -'
    logger.info "\n\nPRINCE XML PDF COMMAND"
    logger.info path
    logger.info ''
    pdf = IO.popen(path, "w+")
    pdf.puts(string)
    pdf.close_write
    result = pdf.gets(nil)
    pdf.close_read
    result.force_encoding('BINARY') if RUBY_VERSION >= "1.9"
    return result
  end
def pdf_from_string ( string , output_file = '-' ) path = self . exe_path ( ) path << ' --silent - -o -' logger . info "\n\nPRINCE XML PDF COMMAND" logger . info path logger . info '' pdf = IO . popen ( path , "w+" ) pdf . puts ( string ) pdf . close_write result = pdf . gets ( nil ) pdf . close_read result . force_encoding ( 'BINARY' ) if RUBY_VERSION >= "1.9" return result end
Makes a pdf from a passed in string.
Makes a pdf from a passed in string .
# Don't spew errors to the standard out...and set up to take IO # as input and output # Show the command used... # Actually call the prince command, and pass the entire data stream back.
string
output_file