Created
October 10, 2023 12:49
-
-
Save bjoerntx/4eb63d7f2a73a1cc4acf2fd668f62661 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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