Sha256: df0474900087fdfde9a656bcfe30b6696cc2310ac4fade4e3342f6d3693a0e45

Contents?: true

Size: 318 Bytes

Versions: 1

Compression:

Stored size: 318 Bytes

Contents

module PhantomPDF
  def url_to_pdf(url, output_file = Tempfile.new(['output', '.pdf']))
    `phantomjs #{ rasterize_path } '#{ url }' '#{ output_file.path }'`
    output_file
  end

  protected

  def rasterize_path
   File.join(Gem::Specification.find_by_name("phantom_pdf").gem_dir, 'lib', 'rasterize.js')
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
phantom_pdf-0.0.2 lib/phantom_pdf.rb