0

I have to initialize the PDFNet library once in my app. I did it in my app.rb which is run first

# app.rb
require 'PDFNetC/Lib/PDFNetRuby'
include PDFNetRuby
PDFNet.Initialize(ENV['PDFTRON_LICENSE_KEY'])

Later in my controller I need to convert pdf to xod for which I will require the initialized PDFNet instance

# SomeController.rb
out_file_path = "#{ENV['TEMP_DIR']}/#{Time.now.to_i}.xod"
::PDFNetRuby::Convert.ToXod(in_file_path, out_file_path)
File.open(out_file_path, 'rb')

Will the above method get the license registerd instance of PDFNet?

gmuraleekrishna
  • 3,375
  • 1
  • 27
  • 45

1 Answers1

0

PDFNet.Initialize is a process wide call, so if both code snippets are in the same process, both will be in licensed mode.

Ryan
  • 2,473
  • 1
  • 11
  • 14
  • Is PDFNet a singleton? Why isn't that using an instance to do the conversion? – gmuraleekrishna Jun 23 '16 at 08:53
  • PDFNet is fully compatible with multi-threading, but some API calls are synchronized and affect all threads. PDFNet.Initialize is such a call. If you are having a particular issue, perhaps you should create a new SO question detailing what exactly that is. Or edit this one, as it is unclear what issue (if any) you are having. – Ryan Jun 23 '16 at 16:03