Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created March 18, 2025 11:47
Show Gist options
  • Save bjoerntx/8c0c342c7c4614a3d1f5d1dd4619593c to your computer and use it in GitHub Desktop.
Save bjoerntx/8c0c342c7c4614a3d1f5d1dd4619593c to your computer and use it in GitHub Desktop.
using TXTextControl;
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
// Add a paragraph to the document
TXTextControl.Selection selection = new TXTextControl.Selection(0, 0);
selection.Text = "Hello, Linux!";
// Set the paragraph format
selection.ParagraphFormat = new ParagraphFormat()
{
Alignment = HorizontalAlignment.Center,
BackColor = System.Drawing.Color.LightGray,
Frame = Frame.BottomLine,
FrameLineColor = System.Drawing.Color.Red,
FrameStyle = FrameStyle.Double,
FrameLineWidth = 10,
};
// Set the font format
selection.FontSize = 240; // 240 twips = 12 pt
selection.FontName = "Arial";
selection.Bold = true;
// Apply the changes to the document
tx.Selection = selection;
// 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