|
PdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
PdfTextBoxField field = new PdfTextBoxField(page, "datePick");
field.Bounds = new RectangleF(10, 10, 100, 20);
field.Actions.KeyPressed=new PdfJavaScriptAction("AFDate_KeystrokeEx(\"m/d/yy\")");
field.Actions.Format = new PdfJavaScriptAction("AFDate_FormatEx(\"m/d/yy\")");
document.Form.Fields.Add(field);
document.Save("Output.pdf");
document.Close(true); |
|
textBoxField2[index] = new PdfTextBoxField(pdfDoc.Pages[1], individualControls.Header);
textBoxField2[index].ToolTip = individualControls.Header;
PdfTrueTypeFont font1 = new PdfTrueTypeFont(f);
textBoxField2[index].Font = font1;
textBoxField2[index].BorderColor = new PdfColor(Color.Gray);
textBoxField2[index].BorderStyle = PdfBorderStyle.Beveled;
textBoxField2[index].Bounds = bounds;
pdfDoc.Form.Fields.Add(textBoxField2[index]);
// fill the Text Box value
textBoxField2[index].Text = "Dummy Name";
// get the form field values from the Text Box
string text = textBoxField2[index].Text;
//Save the document.
MemoryStream ms = new MemoryStream();
document.Save(ms);
document.Close(true);
// your code to save the PDF document(ms) to the DB |
|
PdfLoadedDocument ldDoc = new PdfLoadedDocument("Form.pdf");
// get the value from the Text Box
var test = (ldDoc.Form.Fields[0] as PdfLoadedTextBoxField).Text;
MemoryStream ms = new MemoryStream();
ldDoc.Save(ms);
ldDoc.Close(true);
// your code to save the PDF document(ms) to the DB |
|
PdfDocument document = new PdfDocument();
PdfPage page = document.Pages.Add();
PdfTextBoxField textBoxField = new PdfTextBoxField(page, "Name");
textBoxField.Bounds = new RectangleF(0, 0, 100, 20);
textBoxField.ToolTip = "First Name";
textBoxField.Text = "Hello";
document.Form.Fields.Add(textBoxField);
PdfButtonField submitButton = new PdfButtonField(page, "Submit data");
submitButton.Bounds = new RectangleF(100, 60, 50, 20);
submitButton.ToolTip = "Submit";
document.Form.Fields.Add(submitButton);
PdfSubmitAction submitAction = new PdfSubmitAction("http://localhost:62249/api/Values");
submitAction.DataFormat = SubmitDataFormat.Html;
submitButton.Actions.GotFocus = submitAction;
document.Save("Output.pdf");
document.Close(true); |
|
public string PdfSubmit(FormCollection person)
{
// My logic to save the data from form collection extraction into DB model.
} |
|
public class FormCollection
{
public string Name { get; set; }
} |
PdfDocument document = new PdfDocument(); PdfPage page = document.Pages.Add(); PdfTextBoxField textBoxField = new PdfTextBoxField(page, "Name"); textBoxField.Bounds = new RectangleF(0, 0, 100, 20); textBoxField.ToolTip = "First Name"; textBoxField.Text = "Hello"; document.Form.Fields.Add(textBoxField); PdfButtonField submitButton = new PdfButtonField(page, "Submit data"); submitButton.Bounds = new RectangleF(100, 60, 50, 20); submitButton.ToolTip = "Submit"; document.Form.Fields.Add(submitButton); PdfSubmitAction submitAction = newPdfSubmitAction("http://localhost:62249/api/Values"); submitAction.DataFormat = SubmitDataFormat.Html; submitButton.Actions.GotFocus = submitAction; document.Save("Output.pdf"); document.Close(true); |
ate=DateTime.Now.ToString("dd/MM/yyyy"),Code="Platina",Description="platina2",Group="ct02",Value=20.42,Unit="Percentagem",Day=false,Month=false,Year=true,Vat=false}, newBusinessConfiguration(){Id=7,Date=DateTime.Now.ToString("dd/MM/yyyy"),Code="Ouro",Description="ourogrosso",Group="ct01",Value=34.90,Unit="Unidade",Day=false,Month=true,Year=false,Vat=false}, newBusinessConfiguration(){Id=8,Date=DateTime.Now.ToString("dd/MM/yyyy"),Code="Ouro",Description="ourofino",Group="ct01",Value=34.32,Unit="Euro",Day=false,Month=false,Year=true,Vat=false}, newBusinessConfiguration(){Id=9,Date=DateTime.Now.ToString("dd/MM/yyyy"),Code="Ouro",Description="ourogrosso",Group="ct01",Value=34.90,Unit="Euro",Day=false,Month=true,Year=false,Vat=false}, newBusinessConfiguration(){Id=10,Date=DateTime.Now.ToString("dd/MM/yyyy"),Code="Prata",Description="Prata950",Group="ct03",Value=0.39,Unit="Unidade",Day=true,Month=false,Year=false,Vat=true}, newBusinessConfiguration(){Id=11,Date=DateTime.Now.ToString("dd/MM/yyyy"),Code="Prata",Description="Prata925",Group="ct03",Value=0.37,Unit="Euro",Day=true,Month=false,Year=false,Vat=false}, }; ViewBag.GridNegocios=Gridname(dataSource); returnView(); } publicHtmlStringGridname(List<BusinessConfiguration>dataSource) { objectregex=new{required=true}; ViewBag.dropdown=DropDownData.GetAllRecords(); //DropDownConfiguration[]dropdown=newDropDownConfiguration[] //{ //newDropDownConfiguration(){Value="one",Text="one"}, //newDropDownConfiguration(){Value="two",Text="one"}, //newDropDownConfiguration(){Value="three",Text="one"}, //newDropDownConfiguration(){Value="test",Text="test"}, //}; List<GridColumn>lstColumns=newList<GridColumn>() { newGridColumn(){Field="Id",HeaderText="Id",IsPrimaryKey=true,TextAlign=Syncfusion.EJ2.Grids.TextAlign.Right,Visible=false}, newGridColumn(){Field="Date",HeaderText="Data",EditType="datepickeredit",Format="yMd",ValidationRules=regex,TextAlign=Syncfusion.EJ2.Grids.TextAlign.Right,Width="150"}, newGridColumn(){Field="Code",HeaderText="Código",ValidationRules=regex,TextAlign=Syncfusion.EJ2.Grids.TextAlign.Left,Width="70"}, newGridColumn(){Field="Description",HeaderText="Descrição",ValidationRules=regex,TextAlign=Syncfusion.EJ2.Grids.TextAlign.Left,Width="150"}, newGridColumn(){Field="Group",HeaderText="Grupo",ValidationRules=regex,TextAlign=Syncfusion.EJ2.Grids.TextAlign.Left,Width="60"}, newGridColumn(){Field="Value",HeaderText="Valor",EditType="numericedit",ValidationRules=regex,TextAlign=Syncfusion.EJ2.Grids.TextAlign.Right,Width="60"}, newGridColumn(){Field="Unit",HeaderText="Unidade",EditType="dropdownedit",Edit=(new{@params=new{value="one",fields=new{text="ShipName",value="ShipName"},[email protected]}}),TextAlign=Syncfusion.EJ2.Grids.TextAlign.Right,Width="70"}, newGridColumn(){Field="Day",HeaderText="Dia",EditType="booleanedit",DisplayAsCheckBox=true,Width="50"}, newGridColumn(){Field="Month",HeaderText="Mês",EditType="booleanedit",DisplayAsCheckBox=true,Width="50"}, newGridColumn(){Field="Year",HeaderText="Ano",EditType="booleanedit",DisplayAsCheckBox=true,Width="50"}, newGridColumn(){Field="Vat",HeaderText="Iva",EditType="booleanedit",DisplayAsCheckBox=true,Width="50"}, }; Common.Toolbarbar=newCommon.Toolbar() { Add=true, Edit=true, Delete=true, Update=true, Cancel=true, ExcelExport=true, Click="toolbarClick", }; Common.GridFactorybuilder=newCommon.GridFactory() { ID="negocios", DataSource=dataSource, AllowExportExcel=true, AllowPagging=true, AllowFiltering=true, AllowSorting=true, AllowGrouping=true, PageSize=5, AllowEditing=true, AllowAdding=true, AllowDeleting=true, ShowConfirmDialog=true, ShowDeleteConfirmDialog=true, Columns=lstColumns, Toolbar=bar, };
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
|
|