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 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:DifferenceBetweenFile // 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 + "DifferenceBetweenFile_out.pdf"); Document document = new Document(dataDir + "FilledForm - 2.pdf"); // Now we need to add a textfield just upon the original one FormEditor editor = new FormEditor(document); 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 + "DifferenceBetweenFile_out.pdf"); // ExEnd:DifferenceBetweenFile }
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 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 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/"); //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 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/"); //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 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() { // 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:SetJSPushButton // 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 JavaScript form.SetFieldScript("pushbutton", "app.alert('Hello World!');"); // Save update document form.Save(dataDir + "SetJSPushButton_out_.pdf"); // ExEnd:SetJSPushButton }
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: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: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() { // 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: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: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() { // 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 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() { // 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/"); //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: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 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: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() { 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 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"); }