I am trying to use PDF Tron in ruby service and initializing PDFTron using ENV variable.
require 'PDFNetC/Lib/PDFNetRuby'
include PDFNetRuby
module Converters
class PDFToXODConverter
def self.convert(in_file_path)
out_file_path = "#{ENV['TEMP_DIR']}/#{Time.now.to_i}.xod"
PDFNet.Initialize(ENV['PDFTRON_LICENSE_KEY'])
Convert.ToXod(in_file_path, out_file_path)
File.open(out_file_path, 'rb')
end
end
end
I don't want to set the key in test environment. Bit Initialize throws a Bad licence key exception when running the test without the key or key set to an empty string.
How to use PDFNet.Initialize in unit tests?