This interface enables you to create an output plug-in. Once you have created the plugin, when you are assembling a document, you can see the plug-in by selecting File > Send Document To... The plug-in also adds a new End of Interview output option. You can, for example, create a plug-in that outputs documents to places like Google Drive or SkyDrive.
When HotDocs starts up, it attempts to load each registered plug-in. If it finds a plug-in that implements the IOutputPlugin interface, HotDocs calls:
1. Initialize to load and initialize the plug-in. (If initialize returns a failure code, HotDocs will stop calling plug-in functions.)
2. LibraryIntialized to complete initialization of the plug-in.
3. GetPlugInfo to retrieve the plug-in information.
When a user selects your plug-in's menu, HotDocs then calls:
4. DocumentAssembled to perform output options on the assembled template.
Function | |
![]() |
After document is assembled, this is called to output the plug-in to its destination repository. |
![]() |
This function is called to get information about plug-in functionality. |
![]() |
This function is called when HotDocs starts up and add-in is loaded. |
![]() |
This function is called when HotDocs starts up and add-in is loaded and the main window is created. |
Property | Description |
![]() |
This property is called to get the command Id (such as menu ID) associated with this plug-in. |
The following Visual C# example implements the HotDocs.IOutputPlugin interface along with using the HotDocs.IPluginPreferences interface:
[ComVisible(true)] [Guid("12345678-1111-2222-AAAA-DDDDDDDDDDDD")] public class SendToFolder : HotDocs.IOutputPlugin, HotDocs.IPluginPreferences { private string _dlgfolderPath; private int _commandId = 0; private string _outputPath = "OutputFolder"; //Copy assembled template to folder of user choice. public bool DocumentAssembled(string filePath, bool bIsTempFile, string templateTitle, string templateFilePath) { RegistryKey getKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(_outputPath, true); if (getKey != null) { string folderPath = (string)getKey.GetValue(_outputPath); string getExt = System.IO.Path.GetExtension(filePath); if (System.IO.File.Exists(System.IO.Path.Combine(folderPath, templateTitle) + getExt)) { int i = 0; while (System.IO.File.Exists(System.IO.Path.Combine(folderPath, templateTitle) + i + getExt)) { i++; } System.IO.File.Copy(filePath, System.IO.Path.Combine(folderPath, templateTitle) + i + getExt); } else { System.IO.File.Copy(filePath, System.IO.Path.Combine(folderPath, templateTitle) + getExt); } } else { createFolderPath(); } return true; } public void GetPluginInfo(ref string UI_Name, ref string pluginToken, ref bool bIncludeAtInterviewEnd, ref Icon Icon, ref string supportedFileExtensions) { UI_Name = "Output Folder"; pluginToken = "HDSendToFolderOutputPlugin"; bIncludeAtInterviewEnd = true; Icon.LoadIcon(@"C:\images\SendToFolder.ico"); supportedFileExtensions = ".docx;.rtf;.pdf"; } public void Initialize() { } public void LibraryInitialized() { } public int commandId { get { return _commandId; } set { _commandId = value; } } //Preference: Calls method, opens a dialog and allows users to set a folder path that is written to the registry. public void Edit(IntPtr parentWindowHandle) { createFolderPath(); } //Opens dialog form to allow user to set preferences. public void createFolderPath() { dlgChooseFolder dlg = new dlgChooseFolder(); dlg.Show(); _dlgfolderPath = dlg.folderPath; } [ComRegisterFunction] public static void RegisterPlugin(Type t) { HotDocs.Application app = new HotDocs.Application(); app.Plugins.Register("{12345678-1111-2222-AAAA-DDDDDDDDDDDD}", "SendToFolder Output Plugin", 100, 1); System.Runtime.InteropServices.Marshal.ReleaseComObject(app); } [ComUnregisterFunction] public static void UnRegisterPlugin(Type t) { HotDocs.Application app = new HotDocs.Application(); app.Plugins.Unregister("{12345678-1111-2222-AAAA-DDDDDDDDDDDD}"); System.Runtime.InteropServices.Marshal.ReleaseComObject(app); }