Load file in extension


Hi, I'm trying to load a font (working on an extension to create a pdf). I added a folder and loaded the font inside. So far, so good.

I've tested this in a simple console app and it worked as expected.

public string GetApplicationRoot()

           // This will get the executable, which would be the Debug folder in the case of a console app
            var exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);

            // Search for the bin folder and return that path
            Regex appPathMatcher = new Regex(@"(?<!fil)[A-Za-z]:\\+[\S\s]*?(?=\\+bin)");
            var appRoot = appPathMatcher.Match(exePath).Value;
            return appRoot;

Then I just had to concatenate the folder I wanted and the name and extension of the file. Done.

But in Outsystems it seems to be a bit more tricky, as I read it will search on the Outsystems app espace (C:\Program Files\OutSystems\Platform Server\running\{espace}\bin2).

How can I get to the folder in my extension from here?


Ok, so I was googling and experimenting and I ended up copying the font to my extension folder and in Integration Studio I set "copy to binaries directory" as the deploy action.

And in the code I just wrote this:

var FontSymbols = PdfFontFactory.CreateFont(System.IO.Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath) + @"\wingdings2.ttf");

This way it loaded the font. :)