<body>
setEvent()
checkFormCompleted
PdfDocumentSettings.EnforceRequired
PdfWebControl.CreateDocument
<%@ Register Assembly="APPortalUI" Namespace="APPortalUI.Web.UI" TagPrefix="apPortalUI" %> <html> <head> <script type="text/javascript"> function setEvent() { var myApi = new PdfWebControlApi('<%=this.PdfWebControl1.DivID%>'); myApi.addEventListener('save', function () { var completed = this.checkFormCompleted(); if (!completed) { alert('Please complete all required fields, which are highlighted in red.'); return false; } }); myApi.addEventListener('saveComplete', function () { var sigReq = $('#<%=this.hdnSignatureRequired.ClientID%>').val() == '1'; var signed = $('#<%=this.hdnSigned.ClientID%>').val() == '1'; if (sigReq && !signed) { $('#divSignature').dialog('open'); } else if (sigReq && signed) { document.forms["myform"].submit(); } else { window.location.href = '/ThankYou.aspx'; } }); } </script> </head> <body onload="setEvent();"> <input type="button" id="saveForm1" value="Save Form" class="saveForm" /> <apPortalUI:PdfWebControl id="PdfWebControl1" runat="server" height="900px" width="100%" onsavecomplete="PdfWebControl1_SaveComplete" HideSideBar="True" HideTopBar="True" ViewerZoomDefault="ZoomFitWidth100" /> </body> </html>
protected void Page_Load(object sender, EventArgs e) { if (!IsCallback) { if (IsPostBack) { SignForm(); } else LoadPDF(); } } void LoadPDF() { int userID, formID, userFormID; int.TryParse(Request.QueryString["UserID"], out userID); int.TryParse(Request.QueryString["FormID"], out formID); int.TryParse(Request.QueryString["UserFormID"], out userFormID); UserID = userID; FormID = formID; UserFormID = userFormID; CurrentUP = DataAccessSQL.GetPDFUserProfile(UserID); CurrentFF = DataAccessSQL.GetFormFields(FormID); if (UserFormID > 0) { CurrentUF = DataAccessSQL.GetUserForm(UserFormID, null, null); UserID = CurrentUF.UserID; FormID = CurrentUF.SourceFormID; hdnSigned.Value = (CurrentUF.Signed ? "1" : "0"); } CurrentSF = DataAccessSQL.GetSourceForm(FormID, null); hdnSignatureRequired.Value = (CurrentSF.SignatureReqd ? "1" : "0"); string filePath = (UserFormID > 0) ? GetUserFormsFilePath(CurrentUF.PDFName) : GetSourceFormsFilePath(CurrentSF.FilePath); byte[] pdfData = File.ReadAllBytes(filePath); this.PdfWebControl1.CreateDocument(CurrentSF.FormName, pdfData, PdfDocumentSettings.IsReadOnlyExceptFormFields | PdfDocumentSettings.EnforceRequired); PrefillPDF(CurrentUP); }
ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.