Load an embedded MRT form with LoadFromResource, export it to PDF, and open the generated document.

Resolving the embedded template. Instead of relying on an external file, the application reads the MRT definition from the assembly resource collection.

Loading and exporting it. The sequence in Loading a Form from Resource/Program.cs identifies the resource, loads it into StiForm, and produces the PDF:
var form = new StiForm();
form.LoadFromResource(
    Type.GetType("Loading_a_Form_from_Resource.Program").Assembly,
    "Loading a Form from Resource.Data.SoftwareEvaluationSurvey.mrt");

var exporter = new StiPdfExporter();
var pdf = exporter.ExportForm(form);

string path = "form.pdf";
File.WriteAllBytes(path, pdf);

Process.Start(new ProcessStartInfo(path) { UseShellExecute = true });

Resource names. The namespace and embedded file name must match the manifest resource name generated by the project.

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.