Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created April 5, 2024 19:22
Show Gist options
  • Save bjoerntx/71e4367afd2f5e563c34b22f74a5c285 to your computer and use it in GitHub Desktop.
Save bjoerntx/71e4367afd2f5e563c34b22f74a5c285 to your computer and use it in GitHub Desktop.
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
var sHtml = "<strong>This is a <span style=\"color: red;\">sample</span> <u>document</u>!</strong>";
tx.Load(sHtml, TXTextControl.StringStreamType.HTMLFormat);
// adding a header
tx.HeadersAndFooters.Add(TXTextControl.HeaderFooterType.Header);
var header = tx.HeadersAndFooters.GetItem(TXTextControl.HeaderFooterType.Header);
header.Selection.Text = "This is the header";
// save the document
tx.Save("results.pdf", TXTextControl.StreamType.AdobePDF);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment