The Mi-Forms Designer already allows for the definition of standard datapaths which allow for the generation of form page or field images when a form session is finished. However, there are many scenarios that may require more control over the resulting image and when it is created.
In the .NET form script, the RenderEngine class enables a developer to specify whether to render a form page, a form field, and even an area of a form page given coordinates and size. The RenderEngines offers a number of possible options including whether to render ink or values for those fields that contain both.
As an example, the attached "Render Freeforms.mfd" example form and script contains the following in .NET form script:
<MiCode(ControlScriptEventType.AfterInkAdded, "RenderFreeforms")> _ Public Sub Ctl_RenderFreeforms_AfterInkAdded(ByVal e As AfterInkAddedEventArgs) Try Dim xEngine As New RenderEngine Dim xBitmap As System.Drawing.Bitmap xEngine.Type = RenderType.AllInk xBitmap = xEngine.RenderField(_form.GetFormControlByName("Freeform_1"), 200/2.54) xBitmap.Save("c:\temp\Freeform_1.png") xBitmap = xEngine.RenderField(_form.GetFormControlByName("Freeform_2"), 200/2.54) xBitmap.Save("c:\temp\Freeform_2.png") MsgBox("Freeforms images save to c:\Temp...") Catch ex As Exception LogMessage(ex.message) MsgBox("An error occurred. Details: " & ex.Message) End Try End Sub
The RenderEngine is used to render the Freeform_1 field, save to c:\temp\Freeform_1.png and then the same for the Freeform_2 field which exports to a c:\temp\Freeform_2.png file.
Note that the above action are triggered when the "RenderFreeforms" hotspot is inked.
The RenderEngine class has a variety of options and configurations. To investigate more, open the .NET form script default editor and hit "F1". From the Help documentation, search for RenderEngine.