Source code documentation samples give simple and easy method to install a needed feature into your application. What is ByteScout PDF Suite? It is the bundle that provides six different SDK libraries to work with PDF from generating rich PDF reports to extracting data from PDF documents and converting them to HTML. This bundle includes PDF (Generator) SDK, PDF Renderer SDK, PDF Extractor SDK, PDF to HTML SDK, PDF Viewer SDK and PDF Generator SDK for Javascript. It can help you to add submit form action to pdf with pdf sdk in your C# application.
This prolific sample source code in C# for ByteScout PDF Suite contains various functions and other necessary options you should do calling the API to add submit form action to pdf with pdf sdk. This C# sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Use of ByteScout PDF Suite in C# is also described in the documentation included along with the product.
You can download free trial version of ByteScout PDF Suite from our website with this and other source code samples for C#.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
using System;
using System.Diagnostics;
using Bytescout.PDF;
namespace SubmitFormActionExample
{
/// <summary>
/// This example demonstrates how to submit or reset form.
/// </summary>
class Program
{
static void Main()
{
// Create new document
Document pdfDocument = new Document();
pdfDocument.RegistrationName = "demo";
pdfDocument.RegistrationKey = "demo";
// Add page
Page page = new Page(PaperFormat.A4);
pdfDocument.Pages.Add(page);
// Create sample form
Font font = new Font(StandardFonts.Times, 14);
Brush brush = new SolidBrush();
// EditBox
EditBox editBox = new EditBox(20, 20, 100, 25, "editBox1");
editBox.Text = "editBox1";
page.Annotations.Add(editBox);
// CheckBox
CheckBox checkBox = new CheckBox(20, 60, 15, 15, "checkBox1");
page.Annotations.Add(checkBox);
page.Canvas.DrawString("CheckBox", font, brush, 45, 60);
// Add Submit button
PushButton submitButton = new PushButton(20, 120, 80, 25, "buttonSubmit");
submitButton.Caption = "Submit";
page.Annotations.Add(submitButton);
// Add action
SubmitFormAction submitAction = new SubmitFormAction(new Uri("http://login.live.com"));
submitAction.SubmitFormat = SubmitDataFormat.HTML;
submitAction.SubmitMethod = SubmitMethod.Get;
submitAction.Fields.Add(editBox);
submitAction.Fields.Add(checkBox);
submitButton.OnActivated = submitAction;
// Add Reset button
PushButton resetButton = new PushButton(120, 120, 80, 25, "butonReset");
resetButton.Caption = "Reset";
page.Annotations.Add(resetButton);
// Add action
ResetFormAction resetAction = new ResetFormAction();
resetAction.Fields.Add(editBox);
resetAction.Fields.Add(checkBox);
resetButton.OnActivated = resetAction;
// Save document to file
pdfDocument.Save("result.pdf");
// Cleanup
pdfDocument.Dispose();
// Open result document in default associated application (for demo purpose)
ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf");
processStartInfo.UseShellExecute = true;
Process.Start(processStartInfo);
}
}
}
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout PDF Suite Home Page
Explore ByteScout PDF Suite Documentation
Explore Samples
Sign Up for ByteScout PDF Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: