Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 16, 2023 09:02
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/9b3634aea7e666d91a07fc4da9e7a07d to your computer and use it in GitHub Desktop.
Save bjoerntx/9b3634aea7e666d91a07fc4da9e7a07d to your computer and use it in GitHub Desktop.
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl())
{
tx.Create();
// load DOC or RTF file
//tx.Load("mydocument.doc", TXTextControl.StreamType.MSWord);
//tx.Load("mydocument.rtf", TXTextControl.StreamType.RichTextFormat);
// load DOCX file
tx.Load("Documents/mydocument.docx", TXTextControl.StreamType.WordprocessingML);
// optionally set the save settings
TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings()
{
Author = "Text Control",
CreationDate = DateTime.Now,
CreatorApplication = "TX Text Control Sample Application",
DocumentAccessPermissions = TXTextControl.DocumentAccessPermissions.AllowAll
};
// save as PDF
tx.Save("mydocument.pdf", TXTextControl.StreamType.AdobePDF, saveSettings);
Console.WriteLine("Document has been converted!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment