0

I've attached a font (.ttf) file to a Java Script Library in Notes. This library is attached to a Java Agent. In that agent I can get an inputstream on the font file using this code:

InputStream is = this.getClass().getResourceAsStream("/SourceSansPro.otf");

That works as expected and I can embed the font in the PDF the Agent produces.

However, I want to do this work from inside a custom class that's inside the Script Library. But the above code doesn't work outside the "public class JavaAgent" class of the main Agent.

Anybody know why?

I've tried things like this.getClass().getDeclaringClass().getResource.... but to no avail.

Jake

Jake Howlett
  • 169
  • 3
  • 14

1 Answers1

0

Assuming you are just reading the stream, you should be able to instantiate it as you have from within notesMain, and then pass the stream as a parameter to a method or as part of a constructor to the custom class and use it as a field in the custom class or method

angryITguy
  • 9,332
  • 8
  • 54
  • 82
  • Hi Giulio. Fancy seeing you here. Don't ask why but I want to avoid the passing of streams or any other font-related class to the PDF-making routine. It just seems wrong. It's what I've done as a workaround but the purist in me can't sleep until I don't need to do it. – Jake Howlett Aug 13 '12 at 06:59
  • I haunt the Lotus Notes tags.. standard Notes dev and Java. I appreciate being the purist, usually doing it the "right way" bestows a performance benefit or new architectural flexibility as a reward, but sometimes the technology won't behave sensibly, so you do what you gotta do.. – angryITguy Aug 13 '12 at 23:45