This interface lets you create a plug-in that specifies how HotDocs handles certain types of files when they are edited or assembled from the library window. For example, you can change what happens when a user selects an .RTF template in the library and clicks the Edit button. In this case, the plug-in could first locate the template in a document management system, check it out, and open it in the word processor for editing.
When HotDocs starts up, it attempts to load each registered plug-in. If it finds a plug-in that implements the ILibraryWindowFileHandlerExtension interface, HotDocs calls Initialize to load and initialize the plug-in. After initialization, HotDocs calls RegisterFileType to find out which file name extensions will be handled by the plug-in. Then, when a user selects an item in the library with one of these registered file name extensions, HotDocs calls the Assemble or Edit function (depending on whether the user chooses to assemble or edit the selected file) to determine how it should handle the file.
Function | Description |
![]() |
This function is called when a file with one of the registered file name extensions is selected and assembled from the library window. For example, you could use this plug-in to set command-line options for all templates with a given file name extension. Then, when a user assembles a template, the command-line options for that item in the library can be ignored or substituted with different options. |
![]() |
This function is called when a file with one of the registered file name extensions is selected and edited from the library window. For example, this function could check a template out of a document management system before it is edited. |
![]() |
This function is called when HotDocs starts up to determine if it should load the plug-in. If the function fails, HotDocs will not load the plug-in. |
![]() |
This function is called when the library is initialized. |
![]() |
This function registers the file name extensions that will be handled by the library window file handler plug-in. It is called repeatedly until it fails or until callAgain is set to FALSE. |
The following Visual C# example implements the HotDocs.ILibraryWindowFileHandlerExtension interface.
[ComVisible(true)] [Guid("12345678-1111-2222-AAAA-DDDDDDDDDDDD")] public class FileHandlerExt : HotDocs.ILibraryWindowFileHandlerExtension { public void Assemble(string FileName, string switches, ref string alternateFilename, ref string alternateSwitches, ref bool hotdocsProcess) { if (switches == "") alternateSwitches = switches + " /stw"; hotdocsProcess = true; } public void Edit(string FileName, ref string alternateFilename, ref bool hotdocsProcess) { //Add code MessageBox.Show(FileName + " is prevented from editing."); hotdocsProcess = false; } public void Initialize() { } public void LibraryInitialized() { } public void RegisterFileType(int callcounter, ref string extension, ref bool supportEdit, ref bool supportAssembly, ref bool callAgain) { switch (callcounter) { case 0: extension = ".rtf"; supportEdit = true; supportAssembly = true; callAgain = true; break; case 1: extension = ".docx"; supportEdit = true; supportAssembly = true; callAgain = true; break; case 2: extension = ".hpt"; supportEdit = false; supportAssembly = true; callAgain = false; break; default: break; } } [ComRegisterFunction] public static void RegisterPlugin(Type t) { HotDocs.Application app = new HotDocs.Application(); app.Plugins.Register("{12345678-1111-2222-AAAA-DDDDDDDDDDDD}", "File Handler", 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); } }