I am writing a web app in asp.net using the bootstrap framework for style. The purpose is to have a pdf displayed, then the user fills out the pdf and it should get saved to a folder inside the solution for further processing after clicking the button below. I was able to embed the pdf and have it be fully editable, however, I am stuck trying to save it back to the solution. I have researched the web for answers, but the only thing that I think might be useful is the File.writeAllBytes() method. I just can't figure out how to implement it. Any help or suggestions on how to accomplish this is greatly appreciated.
Heres the UI code:
<%@ Page Language="C#" AutoEventWireup="true" masterpagefile="~/Site.Master"
CodeBehind="RenderPDF.aspx.cs" Inherits="DocusignTest.RenderPDF" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<div class="row">
<div class="col-lg-4">
<div class="jumbotron">
<label>First Name:</label>
<input type="text" class="form-control"/>
<label>Last Name:</label>
<input type="text" class="form-control"/>
<label>Email:</label>
<input type="email" class="form-control"/>
</div>
</div>
<div class="col-lg-8">
<!-- this is the pdf the user needs to fill out -->
<embed id="pdf" src="e-docs/PAF.pdf" style="width: 100%; height:1000px"/>
<div class="pager">
<asp:Button ID="eSignButton" runat="server" CssClass="btn btn-primary" Text="Sign" OnClick="eSign_Click" Enabled="false"/>
<input type="checkbox" id="eSignCheckbox" onclick="enableButton();"/>I have filled out this document to the best of my abilities.
</div>
</div>
</div>
<script lang="javascript" type="text/javascript">
var button = WebForm_GetElementById("MainContent_eSignButton")
var checkbox = WebForm_GetElementById("eSignCheckbox")
function enableButton() {
if (checkbox.checked) {
button.disabled = false;
} else {
button.disabled = true;
}
}
</script>
Here is the code-behind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace DocusignTest
{
public partial class RenderPDF : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void eSign_Click(object sender, EventArgs e)
{
savePDF();
}
protected void savePDF()
{
//DO something.
//Maybe using File.writeAllBytes() to save the embedded PDF to folder in solution.
}
}