Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created June 28, 2024 12:07
Show Gist options
  • Save bjoerntx/d8285b15b9c36f9077dca775837593f0 to your computer and use it in GitHub Desktop.
Save bjoerntx/d8285b15b9c36f9077dca775837593f0 to your computer and use it in GitHub Desktop.
using System.Drawing.Printing;
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
tx.Load("test.docx", TXTextControl.StreamType.WordprocessingML);
PrintDocument printDocument = new PrintDocument();
printDocument.PrinterSettings.PrinterName = "Microsoft Print to PDF";
printDocument.PrinterSettings.PrintToFile = true;
printDocument.PrinterSettings.PrintFileName = "test.pdf";
tx.Print(printDocument);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment