Hello, I have a pdf with many form fields that have the same name.
2 questions:
- Is it possible to obtain the collection of all the fields?
- The location does not belong to any of the form fields
This my code:
string ruta1 = @"C:\\borrar\\pruebaPdf.pdf";
string ruta2 = @"C:\\borrar\\pruebaPdf_SALIDA.pdf";
Document opdf = new Document(ruta1);
MessageBox.Show("Encontrado " + opdf.Form.Fields.Length.ToString() + " formularios");
Aspose.Pdf.Forms.TextBoxField campo = opdf.Form.Fields[0] as Aspose.Pdf.Forms.TextBoxField;
TextFragment textFragment = new TextFragment("(LOCALIZADO)");
textFragment.Position = new Position(campo.Rect.LLX, campo.Rect.LLY);
textFragment.TextState.FontSize = 12;
textFragment.TextState.Font = FontRepository.FindFont("TimesNewRoman");
textFragment.TextState.BackgroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.LightGray);
textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Red);
TextBuilder textBuilder = new TextBuilder(opdf.Pages[campo.PageIndex]);
// Append the text fragment to the PDF page
textBuilder.AppendText(textFragment);
opdf.Save(ruta2);
System.Diagnostics.Process.Start(ruta2);
PRUEBAPDF.pdf (3.5 KB)
Thank you!