Method: PDFToHTMLR::PdfFileUrl#initialize
- Defined in:
- lib/pdftohtmlr.rb
#initialize(input_url, target_path = nil, user_pwd = nil, owner_pwd = nil) ⇒ PdfFileUrl
Returns a new instance of PdfFileUrl.
95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/pdftohtmlr.rb', line 95 def initialize(input_url, target_path=nil, user_pwd=nil, owner_pwd=nil) # check to make sure file is legit begin if ((input_url =~ URI::regexp).nil?) raise PDFToHTMLRError, "invalid file url" end tempfile = Tempfile.new('pdftohtmlr') File.open(tempfile.path, 'wb') {|f| f.write(open(input_url).read) } super(tempfile.path, target_path, user_pwd, owner_pwd) rescue => bang raise PDFToHTMLRError, bang.to_s end end |