This example shows how to generate PDF from form submission.
public IActionResult PostForm()
{
	HttpRequest request = this.HttpContext.Request;
	string requestBodyString;
	try
	{
		request.EnableBuffering();
		byte[] buffer = new byte[Convert.ToInt32(request.ContentLength)];
		request.Body.ReadAsync(buffer, 0, buffer.Length);
		requestBodyString = Encoding.UTF8.GetString(buffer);

		submission = new StiPdfFormSubmission();
		submission.ParseXFDF(buffer);

		dataChanged = true;
	}
	finally
	{
		request.Body.Position = 0;
	}

	return new ContentResult(); 
}

public IActionResult GetPdf()
{
	var form = new StiForm();
	form.Load(FormPath);

	if (submission != null)
	{
		var data = submission.ConvertData(form);
		StiFormFillHelper.FillForm(form, data);
	}
	(form.GetElementByName("Button") as StiButtonElement).Visible = false;
            
	StiPdfExporter exporter = new StiPdfExporter();
	var pdf = exporter.ExportForm(form);

	dataChanged = false;

	return new FileContentResult(pdf, "application/pdf"); 
}

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.