public static void Run() { // ExStart:IdentifyFormFields // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); // First a input pdf file should be assigned Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(dataDir + "FilledForm.pdf"); // Get all field names String[] allfields = form.FieldNames; // Create an array which will hold the location coordinates of Form fields System.Drawing.Rectangle[] box = new System.Drawing.Rectangle[allfields.Length]; for (int i = 0; i < allfields.Length; i++) { // Get the appearance attributes of each field, consequtively FormFieldFacade facade = form.GetFieldFacade(allfields[i]); // Box in FormFieldFacade class holds field's location. box[i] = facade.Box; } form.Save(dataDir + "IdentifyFormFields_1_out.pdf"); Document doc = new Document(dataDir + "FilledForm - 2.pdf"); // Now we need to add a textfield just upon the original one FormEditor editor = new FormEditor(doc); for (int i = 0; i < allfields.Length; i++) { // Add text field beneath every existing form field editor.AddField(FieldType.Text, "TextField" + i, allfields[i], 1, box[i].Left, box[i].Top, box[i].Left + 50, box[i].Top + 10); } // Close the document editor.Save(dataDir + "IdentifyFormFields_out.pdf"); // ExEnd:IdentifyFormFields }
public static void Run() { // ExStart:DecorateFields // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); // Open document FormEditor form = new FormEditor(); // Open the document and create a FormEditor object form.BindPdf(dataDir + "DecorateFields.pdf"); // Create a new facade object FormFieldFacade facade = new FormFieldFacade(); // Assign the facade to form editor form.Facade = facade; // Set the backgroud color as red facade.BackgroundColor = System.Drawing.Color.Red; // Set the alignment as center facade.Alignment = FormFieldFacade.AlignCenter; // All text fields will be modified: form.DecorateField(FieldType.Text); // Close and validate the modification like this: form.Save(dataDir + "DecorateFields_out.pdf"); // ExEnd:DecorateFields }
public static void Run() { try { // ExStart:CopyOuterField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); // Open document FormEditor formEditor = new FormEditor(); // Open the document and create a FormEditor object formEditor.BindPdf(dataDir + "CopyOuterField.pdf"); // Copy a text field from one document to another one formEditor.CopyOuterField( dataDir + "input.pdf", "textfield", 1); // Close and save the output document formEditor.Save(dataDir + "CopyOuterField_out.pdf"); // ExEnd:CopyOuterField } catch (Exception ex) { Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); } }
public static void AddSignatureFields() { // ExStart:AddSignatureFields // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); Document doc = new Document(dataDir + "inFile.pdf"); // Create FormEditor object FormEditor editor = new FormEditor(doc); // Add signature fields editor.AddField(FieldType.Signature, "Signature from Alice", 1, 10, 10, 110, 110); editor.AddField(FieldType.Signature, "Signature from John", 1, 120, 150, 220, 250); editor.AddField(FieldType.Signature, "Signature from Smith", 1, 300, 200, 400, 300); // Save the form editor.Save(dataDir + "AddSignatureFields_1_out.pdf"); Document doc2 = new Document(dataDir + "inFile2.pdf"); // Add signature to any of the signature fields PdfFileSignature pdfSign = new PdfFileSignature(doc2); pdfSign.Sign("Signature from John", "Signature Reason", "John", "Kharkov", new PKCS1("inFile1.pdf", "password")); // Each time new signature is added you must save the document pdfSign.Save(dataDir + "AddSignatureFields_2_out.pdf"); Document doc3 = new Document(dataDir + "FilledForm.pdf"); // Add second signature PdfFileSignature pdfSign2 = new PdfFileSignature(doc3); pdfSign2.Sign("Signature from Alice", "Signature Reason", "Alice", "Odessa", new PKCS1(dataDir + "FilledForm - 2.pfx", "password")); // Each time new signature is added you must save the document pdfSign2.Save(dataDir + "AddSignatureFields_3_out.pdf"); // ExEnd:AddSignatureFields }
public static void Run() { // ExStart:FormEditorFeatures // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); Document doc = new Document(dataDir + "inFile.pdf"); // Create instance of FormEditor FormEditor editor = new FormEditor(doc); // Add field in the PDF file editor.AddField(FieldType.Text, "field1", 1, 300, 500, 350, 525); // Add List field in PDF file editor.AddField(FieldType.ListBox, "field2", 1, 300, 200, 350, 225); // Add list items editor.AddListItem("field2", "item 1"); editor.AddListItem("field2", "item 2"); // Add submit button editor.AddSubmitBtn("submitbutton", 1, "Submit Form", "http:// Testwebsite.com/testpage", 200, 200, 250, 225); // Delete list item editor.DelListItem("field2", "item 1"); // Move field to new position editor.MoveField("field1", 10, 10, 50, 50); // Remove existing field from the PDF editor.RemoveField("field1"); // Rename an existing field editor.RenameField("field1", "newfieldname"); // Reset all visual attributes to empty value editor.ResetFacade(); // Set the alignment style of a text field editor.SetFieldAlignment("field1", FormFieldFacade.AlignLeft); // Set appearance of the field editor.SetFieldAppearance("field1", AnnotationFlags.NoRotate); // Set field attributes i.e. ReadOnly, Required editor.SetFieldAttribute("field1", PropertyFlag.ReadOnly); // Set field limit editor.SetFieldLimit("field1", 25); // Save modifications in the output file editor.Save(dataDir + "FormEditorFeatures2_out.pdf"); // ExEnd:FormEditorFeatures }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); //open the document and create a FormEditor object FormEditor formEditor = new FormEditor(dataDir+ "input_form.pdf", dataDir+ "CopyOuterField_out.pdf"); //copy a text field from one document to another one formEditor.CopyOuterField("textfieldform.pdf", "textfield", 1); //close and save the output document formEditor.Save(); }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //open the document and create a FormEditor object FormEditor formEditor = new FormEditor(dataDir+ "input_form.pdf", dataDir+ "output.pdf"); //copy a text field from one document to another one formEditor.CopyOuterField("textfieldform.pdf", "textfield", 1); //close and save the output document formEditor.Save(); }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create FormEditor object FormEditor formEditor = new FormEditor(); //Open Document formEditor.BindPdf(dataDir+ "input.pdf"); //copy a field to another page formEditor.CopyInnerField("textfield", "newfieldname", 0); //close and save the output document formEditor.Save(dataDir+ "output.pdf"); }
public static void Run() { // ExStart:DeleteListItem // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor form = new FormEditor(); // Open the document and create a FormEditor object form.BindPdf(dataDir + "AddListItem.pdf"); // Delete list item form.DelListItem("listbox", "Item 2"); // Save updated file form.Save(dataDir + "DeleteListItem_out.pdf"); // ExEnd:DeleteListItem }
public static void Run() { // ExStart:SetSubmitButtonURL // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor form = new FormEditor(); // Open the document and create a FormEditor object form.BindPdf(dataDir + "input.pdf"); // Set submit URL form.SetSubmitUrl("submitbutton", "http:// Www.aspose.com"); // Save update document form.Save(dataDir + "SetSubmitButtonURL_out.pdf"); // ExEnd:SetSubmitButtonURL }
public static void Run() { // ExStart:SetFieldLimit // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // Adding Field with limit FormEditor form = new FormEditor(); form.BindPdf( dataDir + "input.pdf"); form.SetFieldLimit("textbox1", 15); dataDir = dataDir + "SetFieldLimit_out.pdf"; form.Save(dataDir); // ExEnd:SetFieldLimit Console.WriteLine("\nField added successfully with limit.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:DeleteField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor formEditor = new FormEditor(); // Open Document formEditor.BindPdf(dataDir + "DeleteFormField.pdf"); // Delete field formEditor.RemoveField("textfield"); // Save updated file formEditor.Save( dataDir + "DeleteFormField_out.pdf"); // ExEnd:DeleteField }
public static void Run() { // ExStart:SetFieldLimit // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // Adding Field with limit FormEditor form = new FormEditor(); form.BindPdf(dataDir + "input.pdf"); form.SetFieldLimit("textbox1", 15); dataDir = dataDir + "SetFieldLimit_out.pdf"; form.Save(dataDir); // ExEnd:SetFieldLimit Console.WriteLine("\nField added successfully with limit.\nFile saved at " + dataDir); }
public static void Run() { // ExStart:DeleteListItem // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor form = new FormEditor(); // Open the document and create a FormEditor object form.BindPdf(dataDir + "AddListItem.pdf"); // Delete list item form.DelListItem("listbox", "Item 2"); // Save updated file form.Save(dataDir + "DeleteListItem_out_.pdf"); // ExEnd:DeleteListItem }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); //create FormEditor object FormEditor formEditor = new FormEditor(); //Open Document formEditor.BindPdf(dataDir+ "CopyInnerField.pdf"); //copy a field to another page formEditor.CopyInnerField("textfield", "newfieldname", 0); //close and save the output document formEditor.Save(dataDir+ "CopyInnerField_out.pdf"); }
public static void Run() { // ExStart:MoveField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor formEditor = new FormEditor(); // Open Document formEditor.BindPdf(dataDir + "input.pdf"); // Move field to new location formEditor.MoveField("textfield", 300, 300, 400, 400); // Save updated file formEditor.Save( dataDir + "MoveFormField_out.pdf"); // ExEnd:MoveField }
public static void Run() { // ExStart:DeleteField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor formEditor = new FormEditor(); // Open Document formEditor.BindPdf(dataDir + "DeleteFormField.pdf"); // Delete field formEditor.RemoveField("textfield"); // Save updated file formEditor.Save(dataDir + "DeleteFormField_out.pdf"); // ExEnd:DeleteField }
public static void Run() { // ExStart:MoveField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor formEditor = new FormEditor(); // Open Document formEditor.BindPdf(dataDir + "input.pdf"); // Move field to new location formEditor.MoveField("textfield", 300, 300, 400, 400); // Save updated file formEditor.Save(dataDir + "MoveFormField_out_.pdf"); // ExEnd:MoveField }
public static void Run() { // ExStart:JustifyText // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); using (FileStream source = File.Open(dataDir + "Input1.pdf", FileMode.Open)) { MemoryStream ms = new MemoryStream(); // Create Form Object Aspose.Pdf.Facades.Form form = new Aspose.Pdf.Facades.Form(); // Open Source File form.BindPdf(source); // Fill Text Field form.FillField("Text1", "Thank you for using Aspose"); // Save the document in Memory Stream form.Save(ms); ms.Seek(0, SeekOrigin.Begin); FileStream dest = new FileStream(dataDir + "JustifyText_out.pdf", FileMode.Create); // Create formEditor Object FormEditor formEditor = new FormEditor(); // Open PDF from memory stream formEditor.BindPdf(ms); // Set Text Alignment as Justified formEditor.Facade.Alignment = FormFieldFacade.AlignJustified; // Decorate form field. formEditor.DecorateField(); // Save te resultant file. formEditor.Save(dest); // Close file stream dest.Close(); } // ExEnd:JustifyText }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); //open document FormEditor formEditor = new FormEditor(); //open the document and create a FormEditor object formEditor.BindPdf(dataDir + "input_form.pdf"); //copy a text field from one document to another one formEditor.CopyOuterField("textfieldform.pdf", "textfield", 1); //close and save the output document formEditor.Save(dataDir + "CopyOuterField_out.pdf"); }
public static void Run() { // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); //create FormEditor object and open PDF file FormEditor form = new FormEditor(dataDir+ "input_form.pdf", dataDir+ "DecorateFields_out.pdf"); //create a new facade object FormFieldFacade facade = new FormFieldFacade(); //assign the facade to form editor form.Facade = facade; //set the backgroud color as red facade.BackgroundColor = System.Drawing.Color.Red; //set the alignment as center facade.Alignment = FormFieldFacade.AlignCenter; //all text fields will be modified: form.DecorateField(FieldType.Text); //close and validate the modification like this: form.Save(); }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create instance of FormEditor FormEditor formEditor = new FormEditor(); //Open Document formEditor.BindPdf(dataDir+ "input.pdf"); //add list field in PDF file formEditor.AddField(FieldType.ListBox, "listbox", 1, 300, 200, 350, 225); //add list items formEditor.AddListItem("listbox", "Item 1"); formEditor.AddListItem("listbox", "Item 2"); //add multiple list items once string[] listItems = { "Item 3", "Item 4", "Item 5" }; formEditor.AddListItem("listbox", listItems); //save updated file formEditor.Save(dataDir+ "output.pdf"); }
public static void Run() { // ExStart:DecorateParticularField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor form = new FormEditor(); // Open the document and create a FormEditor object form.BindPdf(dataDir + "input.pdf"); // Set field facade FormFieldFacade fieldFacade = new FormFieldFacade(); form.Facade = fieldFacade; fieldFacade.BackgroundColor = System.Drawing.Color.Red; fieldFacade.FontSize = 14; // Specify the form field which needs to be decorated form.DecorateField("textfield"); // Save updated PDF form form.Save(dataDir + "DecorateParticularField_out.pdf"); // ExEnd:DecorateParticularField }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create instance of FormEditor FormEditor formEditor = new FormEditor(); //Open Document formEditor.BindPdf(dataDir + "input.pdf"); //add list field in PDF file formEditor.AddField(FieldType.ListBox, "listbox", 1, 300, 200, 350, 225); //add list items formEditor.AddListItem("listbox", "Item 1"); formEditor.AddListItem("listbox", "Item 2"); //add multiple list items once string[] listItems = { "Item 3", "Item 4", "Item 5" }; formEditor.AddListItem("listbox", listItems); //save updated file formEditor.Save(dataDir + "output.pdf"); }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //create FormEditor object and open PDF file FormEditor form = new FormEditor(dataDir + "input_form.pdf", dataDir + "output.pdf"); //create a new facade object FormFieldFacade facade = new FormFieldFacade(); //assign the facade to form editor form.Facade = facade; //set the backgroud color as red facade.BackgroundColor = System.Drawing.Color.Red; //set the alignment as center facade.Alignment = FormFieldFacade.AlignCenter; //all text fields will be modified: form.DecorateField(FieldType.Text); //close and validate the modification like this: form.Save(); }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //open document FormEditor formEditor = new FormEditor(); //Open Document formEditor.BindPdf(dataDir+ "input.pdf"); //add field formEditor.AddField(FieldType.Text, "textfield", 1, 100, 100, 200, 150); formEditor.AddField(FieldType.CheckBox, "checkboxfield", 1, 100, 200, 200, 250); formEditor.AddField(FieldType.ComboBox, "comboboxfield", 1, 100, 300, 200, 350); formEditor.AddField(FieldType.ListBox, "listboxfield", 1, 100, 400, 200, 450); formEditor.AddField(FieldType.MultiLineText, "multilinetextfield", 1, 100, 500, 200, 550); //save updated file formEditor.Save(dataDir+ "output.pdf"); }
public static void Run() { // ExStart:AddListItem // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor form = new FormEditor(); // Open the document and create a FormEditor object form.BindPdf(dataDir + "AddListItem.pdf"); // Add list field in PDF file form.AddField(FieldType.ListBox, "listbox", 1, 300, 200, 350, 225); // Add list items form.AddListItem("listbox", "Item 1"); form.AddListItem("listbox", "Item 2"); // Add multiple list items once string[] listItems = { "Item 3", "Item 4", "Item 5" }; form.AddListItem("listbox", listItems); // Save updated file form.Save(dataDir + "AddListItem_out.pdf"); // ExEnd:AddListItem }
public static void Run() { // ExStart:ChangingFieldAppearance // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles(); Document doc = new Document(dataDir + "FilledForm.pdf"); // Open the document and create a Form object FormEditor formEditor = new FormEditor(doc); // Add a text field formEditor.AddField(FieldType.Text, "text1", 1, 200, 550, 300, 575); // Set field attribute - PropertyFlag enumeration contains 4 options formEditor.SetFieldAttribute("text1", PropertyFlag.Required); // Set field limit - this field will take maximum 20 characters as input formEditor.SetFieldLimit("text1", 20); // Close the document formEditor.Save(dataDir + "ChangingFieldAppearance_out.pdf"); // ExEnd:ChangingFieldAppearance }
public static void Run() { // ExStart:AddFormField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor formEditor = new FormEditor(); // Open Document formEditor.BindPdf(dataDir+ "AddFormField.pdf"); // Add field formEditor.AddField(FieldType.Text, "textfield", 1, 100, 100, 200, 150); formEditor.AddField(FieldType.CheckBox, "checkboxfield", 1, 100, 200, 200, 250); formEditor.AddField(FieldType.ComboBox, "comboboxfield", 1, 100, 300, 200, 350); formEditor.AddField(FieldType.ListBox, "listboxfield", 1, 100, 400, 200, 450); formEditor.AddField(FieldType.MultiLineText, "multilinetextfield", 1, 100, 500, 200, 550); // Save updated file formEditor.Save(dataDir+ "AddFormField_out.pdf"); // ExEnd:AddFormField }
public static void Run() { // ExStart:AddFormField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); FormEditor formEditor = new FormEditor(); // Open Document formEditor.BindPdf(dataDir + "AddFormField.pdf"); // Add field formEditor.AddField(FieldType.Text, "textfield", 1, 100, 100, 200, 150); formEditor.AddField(FieldType.CheckBox, "checkboxfield", 1, 100, 200, 200, 250); formEditor.AddField(FieldType.ComboBox, "comboboxfield", 1, 100, 300, 200, 350); formEditor.AddField(FieldType.ListBox, "listboxfield", 1, 100, 400, 200, 450); formEditor.AddField(FieldType.MultiLineText, "multilinetextfield", 1, 100, 500, 200, 550); // Save updated file formEditor.Save(dataDir + "AddFormField_out_.pdf"); // ExEnd:AddFormField }
public static void Run() { try { // ExStart:HorizontallyAndVerticallyRadioButtons // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // Load the previously saved document FormEditor formEditor = new FormEditor(); formEditor.BindPdf(dataDir + "input.pdf"); // RadioGap is distance between two radio button options. formEditor.RadioGap = 4; // Add horizontal radio button formEditor.RadioHoriz = true; // RadioButtonItemSize if size of radio button item. formEditor.RadioButtonItemSize = 20; formEditor.Facade.BorderWidth = 1; formEditor.Facade.BorderColor = System.Drawing.Color.Black; formEditor.Items = new string[] { "First", "Second", "Third" }; formEditor.AddField(FieldType.Radio, "NewField1", 1, 40, 600, 120, 620); // Add other radio button situated vertically formEditor.RadioHoriz = false; formEditor.Items = new string[] { "First", "Second", "Third" }; formEditor.AddField(FieldType.Radio, "NewField2", 1, 40, 500, 60, 550); dataDir = dataDir + "HorizontallyAndVerticallyRadioButtons_out.pdf"; // Save the PDF document formEditor.Save(dataDir); // ExEnd:HorizontallyAndVerticallyRadioButtons Console.WriteLine("\nHorizontally and vertically laid out radio buttons successfully.\nFile saved at " + dataDir); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Run() { try { // ExStart:HorizontallyAndVerticallyRadioButtons // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdf_Forms(); // Load the previously saved document FormEditor formEditor = new FormEditor(); formEditor.BindPdf(dataDir + "input.pdf"); // RadioGap is distance between two radio button options. formEditor.RadioGap = 4; // Add horizontal radio button formEditor.RadioHoriz = true; // RadioButtonItemSize if size of radio button item. formEditor.RadioButtonItemSize = 20; formEditor.Facade.BorderWidth = 1; formEditor.Facade.BorderColor = System.Drawing.Color.Black; formEditor.Items = new string[] { "First", "Second", "Third" }; formEditor.AddField(FieldType.Radio, "NewField1", 1, 40, 600, 120, 620); // Add other radio button situated vertically formEditor.RadioHoriz = false; formEditor.Items = new string[] { "First", "Second", "Third" }; formEditor.AddField(FieldType.Radio, "NewField2", 1, 40, 500, 60, 550); dataDir = dataDir + "HorizontallyAndVerticallyRadioButtons_out_.pdf"; // Save the PDF document formEditor.Save(dataDir); // ExEnd:HorizontallyAndVerticallyRadioButtons Console.WriteLine("\nHorizontally and vertically laid out radio buttons successfully.\nFile saved at " + dataDir); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public static void Run() { try { // ExStart:CopyInnerField // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); // Create FormEditor object FormEditor formEditor = new FormEditor(); // Open Document formEditor.BindPdf(dataDir + "CopyInnerField.pdf"); // Copy a field to another page formEditor.CopyInnerField("textfield", "newfieldname", 1); // Close and save the output document formEditor.Save(dataDir + "CopyInnerField_out_.pdf"); // ExEnd:CopyInnerField } catch (Exception ex) { Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); } }
public static void Main() { // The path to the documents directory. string dataDir = Path.GetFullPath("../../../Data/"); //open document FormEditor formEditor = new FormEditor(); //Open Document formEditor.BindPdf(dataDir + "input.pdf"); //add field formEditor.AddField(FieldType.Text, "textfield", 1, 100, 100, 200, 150); formEditor.AddField(FieldType.CheckBox, "checkboxfield", 1, 100, 200, 200, 250); formEditor.AddField(FieldType.ComboBox, "comboboxfield", 1, 100, 300, 200, 350); formEditor.AddField(FieldType.ListBox, "listboxfield", 1, 100, 400, 200, 450); formEditor.AddField(FieldType.MultiLineText, "multilinetextfield", 1, 100, 500, 200, 550); //save updated file formEditor.Save(dataDir + "output.pdf"); }
public void HasChanges_updated_correctly() { string filePath = Path.Combine(_referenceRepository.Module.WorkingDir, Path.GetRandomFileName()); try { File.WriteAllText(filePath, "Hello↔world", _commands.Module.FilesEncoding); UITest.RunForm <FormEditor>( () => { using (var formEditor = new FormEditor(_commands, filePath, showWarning: false)) { formEditor.ShowDialog(); } }, form => { Assert.False(form.GetTestAccessor().HasChanges); var fileViewerInternal = form.GetTestAccessor().FileViewer.GetTestAccessor().FileViewerInternal; fileViewerInternal.SetText(fileViewerInternal.GetText() + "!", openWithDifftool: null, isDiff: false); Assert.True(form.GetTestAccessor().HasChanges); form.GetTestAccessor().SaveChanges(); Assert.False(form.GetTestAccessor().HasChanges); return(Task.CompletedTask); }); } finally { File.Delete(filePath); } }
public void LoadTaskContent(FormEditor fe, TextBox textID, TextBox textName) { _eSelectType = ESelectType.eSelectTask; _textID = textID; _textName = textName; textBoxUrl.Visible = false; buttonInsert.Visible = false; this.dataGridViewXML.RowHeadersWidth = 20; this.dataGridViewXML.RowTemplate.Height = 23; this.dataGridViewXML.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; System.Windows.Forms.DataGridView dgv = fe.GetTaskListGridView(); for (int i = 0; i < dgv.Columns.Count; ++i) { dataGridViewXML.Columns.Add(dgv.Columns[i].Clone() as DataGridViewColumn); } for (int j = 0; j < dgv.Rows.Count; ++j) { int idx = dataGridViewXML.Rows.Add(); for (int i = 0; i < dgv.Columns.Count; ++i) { dataGridViewXML.Rows[idx].Cells[i].Value = dgv.Rows[j].Cells[i].Value.ToString(); } } }
public ButtonCtrl( FormEditor formEditor, Scintilla editor, ComboBox cboxScriptName, Button btnNewScript, Button btnSaveScript, Button btnRunScript, Button btnStopScript, Button btnKillScript, Button btnClearOutput, Button btnShowSearchBox, Button btnGoto, TextBox tboxGoto, RichTextBox rtboxOutput) { this.formEditor = formEditor; this.cboxScriptName = cboxScriptName; this.btnNewScript = btnNewScript; this.btnSaveScript = btnSaveScript; this.btnRunScript = btnRunScript; this.btnStopLuaCore = btnStopScript; this.btnKillLuaCore = btnKillScript; this.btnClearOutput = btnClearOutput; this.btnShowSearchBox = btnShowSearchBox; this.btnGoto = btnGoto; this.tboxGoto = tboxGoto; this.rtboxOutput = rtboxOutput; this.editor = editor; logUpdater = new VgcApis.Libs.Tasks.Routine( UpdateOutput, VgcApis.Models.Consts.Intervals.LuaPluginLogRefreshInterval); }
public bool StartFileEditorDialog(string filename, bool showWarning = false) { using (var formEditor = new FormEditor(this, filename, showWarning)) return formEditor.ShowDialog() != DialogResult.Cancel; }
private static void RunCommand(string[] args) { if (args.Length > 1) { switch (args[1]) { case "mergeconflicts": GitUICommands.Instance.StartResolveConflictsDialog(); return; case "gitbash": GitCommandHelpers.RunBash(); return; case "gitignore": GitUICommands.Instance.StartEditGitIgnoreDialog(); return; case "remotes": GitUICommands.Instance.StartRemotesDialog(); return; case "blame": if (args.Length > 2) { // Remove working dir from filename. This is to prevent filenames that are too // long while there is room left when the workingdir was not in the path. string fileName = args[2].Replace(Settings.WorkingDir, "").Replace('\\', '/'); GitUICommands.Instance.StartBlameDialog(fileName); } else { MessageBox.Show("Cannot open blame, there is no file selected.", "Blame"); } return; case "browse": GitUICommands.Instance.StartBrowseDialog(GetParameterOrEmptyStringAsDefault(args, "-filter")); return; case "add": case "addfiles": GitUICommands.Instance.StartAddFilesDialog(); return; case "apply": case "applypatch": GitUICommands.Instance.StartApplyPatchDialog(); return; case "branch": GitUICommands.Instance.StartCreateBranchDialog(); return; case "checkout": case "checkoutbranch": GitUICommands.Instance.StartCheckoutBranchDialog(); return; case "checkoutrevision": GitUICommands.Instance.StartCheckoutRevisionDialog(); return; case "init": if (args.Length > 2) { GitUICommands.Instance.StartInitializeDialog(args[2]); } else { GitUICommands.Instance.StartInitializeDialog(); } return; case "clone": GitUICommands.Instance.StartCloneDialog(); return; case "commit": GitUICommands.Instance.StartCommitDialog(); return; case "filehistory": if (args.Length > 2) { //Remove working dir from filename. This is to prevent filenames that are too //long while there is room left when the workingdir was not in the path. string fileName = args[2].Replace(Settings.WorkingDir, "").Replace('\\', '/'); GitUICommands.Instance.StartFileHistoryDialog(fileName); } else { MessageBox.Show("Cannot open file history, there is no file selected.", "File history"); } return; case "fileeditor": if (args.Length > 2) { using (var formEditor = new FormEditor(args[2])) { if (formEditor.ShowDialog() == DialogResult.Cancel) { System.Environment.ExitCode = -1; } } } else { MessageBox.Show("Cannot open file editor, there is no file selected.", "File editor"); } return; case "formatpatch": GitUICommands.Instance.StartFormatPatchDialog(); return; case "pull": GitUICommands.Instance.StartPullDialog(); return; case "push": GitUICommands.Instance.StartPushDialog(); return; case "settings": GitUICommands.Instance.StartSettingsDialog(); return; case "viewdiff": GitUICommands.Instance.StartCompareRevisionsDialog(); return; case "rebase": GitUICommands.Instance.StartRebaseDialog(null); return; case "merge": GitUICommands.Instance.StartMergeBranchDialog(null); return; case "cherry": GitUICommands.Instance.StartCherryPickDialog(); return; case "revert": Application.Run(new FormRevert(args[2])); return; case "tag": GitUICommands.Instance.StartCreateTagDialog(); return; case "about": Application.Run(new AboutBox()); return; case "stash": GitUICommands.Instance.StartStashDialog(); return; default: Application.Run(new FormCommandlineHelp()); return; } } }
private static void RunCommand(string[] args) { Dictionary <string, string> arguments = new Dictionary <string, string>(); for (int i = 2; i < args.Length; i++) { if (args[i].StartsWith("--") && i + 1 < args.Length && !args[i + 1].StartsWith("--")) { arguments.Add(args[i].TrimStart('-'), args[++i]); } else if (args[i].StartsWith("--")) { arguments.Add(args[i].TrimStart('-'), null); } } if (args.Length > 1) { switch (args[1]) { case "mergetool": case "mergeconflicts": if (!arguments.ContainsKey("quiet") || GitCommandHelpers.InTheMiddleOfConflictedMerge()) { GitUICommands.Instance.StartResolveConflictsDialog(); } return; case "gitbash": GitCommandHelpers.RunBash(); return; case "gitignore": GitUICommands.Instance.StartEditGitIgnoreDialog(); return; case "remotes": GitUICommands.Instance.StartRemotesDialog(); return; case "blame": if (args.Length > 2) { // Remove working dir from filename. This is to prevent filenames that are too // long while there is room left when the workingdir was not in the path. string fileName = args[2].Replace(Settings.WorkingDir, "").Replace('\\', '/'); GitUICommands.Instance.StartBlameDialog(fileName); } else { MessageBox.Show("Cannot open blame, there is no file selected.", "Blame"); } return; case "browse": GitUICommands.Instance.StartBrowseDialog(GetParameterOrEmptyStringAsDefault(args, "-filter")); return; case "cleanup": new FormCleanupRepository().ShowDialog(); return; case "add": case "addfiles": GitUICommands.Instance.StartAddFilesDialog(); return; case "apply": case "applypatch": GitUICommands.Instance.StartApplyPatchDialog(); return; case "branch": GitUICommands.Instance.StartCreateBranchDialog(); return; case "checkout": case "checkoutbranch": GitUICommands.Instance.StartCheckoutBranchDialog(); return; case "checkoutrevision": GitUICommands.Instance.StartCheckoutRevisionDialog(); return; case "init": if (args.Length > 2) { GitUICommands.Instance.StartInitializeDialog(args[2]); } else { GitUICommands.Instance.StartInitializeDialog(); } return; case "clone": GitUICommands.Instance.StartCloneDialog(); return; case "commit": Commit(arguments); return; case "filehistory": if (args.Length > 2) { //Remove working dir from filename. This is to prevent filenames that are too //long while there is room left when the workingdir was not in the path. string fileName = args[2].Replace(Settings.WorkingDir, "").Replace('\\', '/'); GitUICommands.Instance.StartFileHistoryDialog(fileName); } else { MessageBox.Show("Cannot open file history, there is no file selected.", "File history"); } return; case "fileeditor": if (args.Length > 2) { using (var formEditor = new FormEditor(args[2])) { if (formEditor.ShowDialog() == DialogResult.Cancel) { System.Environment.ExitCode = -1; } } } else { MessageBox.Show("Cannot open file editor, there is no file selected.", "File editor"); } return; case "formatpatch": GitUICommands.Instance.StartFormatPatchDialog(); return; case "pull": Pull(arguments); return; case "push": Push(arguments); return; case "settings": GitUICommands.Instance.StartSettingsDialog(); return; case "viewdiff": GitUICommands.Instance.StartCompareRevisionsDialog(); return; case "rebase": { string branch = null; if (arguments.ContainsKey("branch")) { branch = arguments["branch"]; } GitUICommands.Instance.StartRebaseDialog(branch); return; } case "merge": { string branch = null; if (arguments.ContainsKey("branch")) { branch = arguments["branch"]; } GitUICommands.Instance.StartMergeBranchDialog(branch); return; } case "cherry": GitUICommands.Instance.StartCherryPickDialog(); return; case "revert": Application.Run(new FormRevert(args[2])); return; case "tag": GitUICommands.Instance.StartCreateTagDialog(); return; case "about": Application.Run(new AboutBox()); return; case "stash": GitUICommands.Instance.StartStashDialog(); return; case "synchronize": Commit(arguments); Pull(arguments); Push(arguments); return; default: Application.Run(new FormCommandlineHelp()); return; } } }
public TestAccessor(FormEditor formEditor) { _formEditor = formEditor; }
private void toolStripButton3_Click(object sender, EventArgs e) { string returnString = "Фамилия".PadRight(30) + "|" + "Должность".PadRight(20) + "|" + "Форм. нагрузка".PadRight(15) + "|" + "Перегрузка".PadRight(10) + "|" + "Недогрузка".PadRight(10) + "|" + "Форм. нагр. по часам".PadRight(20) + "|" + "Форм. ставка".PadRight(12) + "|" + "Факт. нагрузка".PadRight(14) + "|" + "Факт. ставка".PadRight(12) + "|" + "\n"; decimal workloadForm = 0; decimal overload = 0; decimal underload = 0; decimal rateFormByHours = 0; decimal rateForm = 0; decimal workloadFact = 0; decimal rateFact = 0; var q = from eisy in this.bindingSourceEmployeeInSchoolYear.OfType <EmployeeInSchoolYear>() orderby eisy.Post.Id descending select eisy; foreach (EmployeeInSchoolYear eisy in q) { if (eisy.WorkloadForm != 0 || eisy.Overload != 0 || eisy.Underload != 0 || (decimal)eisy.RateFormByHours != 0 || eisy.RateForm != 0 || eisy.WorkloadFact != 0 || (decimal)eisy.RateFact != 0) { returnString += eisy.Fio.PadRight(30) + "|" + eisy.Post.ToString().PadRight(20) + "|" + eisy.WorkloadForm.ToString().PadLeft(15) + "|" + eisy.Overload.ToString().PadLeft(10) + "|" + eisy.Underload.ToString().PadLeft(10) + "|" + eisy.RateFormByHours.ToString().PadLeft(20) + "|" + eisy.RateForm.ToString().PadLeft(12) + "|" + eisy.WorkloadFact.ToString().PadLeft(14) + "|" + eisy.RateFact.ToString().PadLeft(12) + "|" + "\n"; workloadForm += eisy.WorkloadForm; overload += eisy.Overload; underload += eisy.Underload; rateFormByHours += (decimal)eisy.RateFormByHours; rateForm += eisy.RateForm; workloadFact += eisy.WorkloadFact; rateFact += (decimal)eisy.RateFact; } } returnString += "\n"; returnString += "ИТОГО: ".PadRight(30) + "|" + "".PadRight(20) + "|" + workloadForm.ToString().PadLeft(15) + "|" + overload.ToString().PadLeft(10) + "|" + underload.ToString().PadLeft(10) + "|" + rateFormByHours.ToString().PadLeft(20) + "|" + rateForm.ToString().PadLeft(12) + "|" + workloadFact.ToString().PadLeft(14) + "|" + rateFact.ToString().PadLeft(12) + "|" + "\n"; FormEditor fe = new FormEditor(returnString); fe.ShowDialog(); }