Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
O seguinte trecho de código também funciona com a biblioteca Aspose.PDF.Drawing.
Neste artigo, tentamos criar um AcroForm usando o namespace Aspose.Pdf.Facades. Também adicionamos um botão de envio e definimos sua URL de destino. Os seguintes trechos de código mostram como criar o formulário e, em seguida, receber os dados postados na página da web.
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void CreateAcroFormWithFields()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Forms();
// Create an instance of FormEditor class and bind input and output pdf files
using (var editor = new Aspose.Pdf.Facades.FormEditor(dataDir + "input.pdf", dataDir + "output.pdf"))
{
// Create AcroForm fields - I have created only two fields for simplicity
editor.AddField(Aspose.Pdf.Facades.FieldType.Text, "firstname", 1, 100, 600, 200, 625);
editor.AddField(Aspose.Pdf.Facades.FieldType.Text, "lastname", 1, 100, 550, 200, 575);
// Add a submit button and set target URL
editor.AddSubmitBtn("submitbutton", 1, "Submit", "http://localhost/csharptesting/show.aspx", 100, 450, 150, 475);
// Save PDF document
editor.Save();
}
}
// Show the posted values on the target web page
Response.Write("Hello " + Request.Form.Get("firstname") + " " + Request.Form.Get("lastname"));
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.