Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 10, 2023 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/4eb63d7f2a73a1cc4acf2fd668f62661 to your computer and use it in GitHub Desktop.
Save bjoerntx/4eb63d7f2a73a1cc4acf2fd668f62661 to your computer and use it in GitHub Desktop.
[HttpGet]
public string[] GetSVG()
{
lock (_lock)
{
using (TXTextControl.ServerTextControl tx = new ServerTextControl())
{
tx.Create();
tx.Load("App_Data/demo.tx", StreamType.InternalUnicodeFormat);
// create SVGs from all pages with glyph outlines
var svgs = CreateSVG(tx, true, 1, -1);
// convert SVGs to Base64 strings
for (int i = 0; i < svgs.Length; i++)
{
byte[] bytes = Encoding.UTF8.GetBytes(svgs[i]);
svgs[i] = Convert.ToBase64String(bytes);
}
return svgs;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment