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() { // 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() { // ExStart:GetFormFieldValue // The path to the documents directory. string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Forms(); // Create Form Object Aspose.Pdf.Facades.Form pdfForm = new Aspose.Pdf.Facades.Form(); // Open Document pdfForm.BindPdf(dataDir + "FormField.pdf"); // Get form field facade FormFieldFacade fieldFacade = pdfForm.GetFieldFacade("textfield"); // Get facade values Console.WriteLine("Alignment : {0} ", fieldFacade.Alignment); Console.WriteLine("Background Color : {0} ", fieldFacade.BackgroundColor); Console.WriteLine("Border Color : {0} ", fieldFacade.BorderColor); Console.WriteLine("Border Style : {0} ", fieldFacade.BorderStyle); Console.WriteLine("Border Width : {0} ", fieldFacade.BorderWidth); Console.WriteLine("Box : {0} ", fieldFacade.Box); Console.WriteLine("Caption : {0} ", fieldFacade.Caption); Console.WriteLine("Font Name : {0} ", fieldFacade.Font); Console.WriteLine("Font Size : {0} ", fieldFacade.FontSize); Console.WriteLine("Page Number : {0} ", fieldFacade.PageNumber); Console.WriteLine("Text Color : {0} ", fieldFacade.TextColor); Console.WriteLine("Text Encoding : {0} ", fieldFacade.TextEncoding); // ExEnd:GetFormFieldValue }
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() { // 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 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: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 }