Get pdf

Method get_pdf is used for downloading invoice as PDF document.

Return value(s)

This method returns an pdf documant as SOAP attachment.

Authentication

This method requires that you have registered to Maventa and received the API key.

Arguments

  1. API key string (required)
  2. Invoice ID string (required)

Example code

 1   require 'soap/rpc/driver'
 2   require 'soap/attachment'
 3 
 4   driver = SOAP::RPC::Driver.new('https://trx.maventa.com/', 'files')
 5   driver.add_method('get_pdf', 'api_key', 'invoice_id')
 6 
 7   api_key = "" # put here your personal API key.
 8   invoice_id = "" # put here id of the wanted invoice
 9 
10   incoming_file = driver.get_pdf(api_key, invoice_id)
11 
12   begin
13     File.open("invoice_#{invoice_id}.pdf", 'wb') do |f|
14         f << incoming_file.values
15     end
16 
17     puts "OK: PDF RECEIVED SUCCESSFULLY" 
18   rescue
19     puts "ERROR: COULD NOT RECEIVE PDF" 
20   end

Also available in: HTML TXT