Class: PDFToHTMLR::PdfFileUrl
Overview
Handle a URI as a remote path to a PDF, extends PdfFile
Instance Attribute Summary
Attributes inherited from PdfFile
#format, #owner_pwd, #path, #target, #user_pwd
Instance Method Summary collapse
-
#initialize(input_url, target_path = nil, user_pwd = nil, owner_pwd = nil) ⇒ PdfFileUrl
constructor
A new instance of PdfFileUrl.
Methods inherited from PdfFile
#convert, #convert_to_document, #convert_to_xml, #convert_to_xml_document
Constructor Details
#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 |