ByteScout PDF SDK - C# - Add Submit Form Action to PDF - ByteScout

ByteScout PDF SDK – C# – Add Submit Form Action to PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – C# – Add Submit Form Action to PDF

How to add submit form action to PDF in C# and ByteScout PDF SDK

How to add submit form action to PDF in C#

Learn how to add submit form action to PDF in C# with this source code sample. ByteScout PDF SDK: the library for pdf documents generation, modification and updates. Can also generate and fill PDF forms. Provides support for text (fonts, style, size, font family), layers, pdf form fields, vector and raster drawings. It can add submit form action to PDF in C#.

This code snippet below for ByteScout PDF SDK works best when you need to quickly add submit form action to PDF in your C# application. Just copy and paste the code into your C# application’s code and follow the instruction. You can use these C# sample examples in one or many applications.

Our website provides trial version of ByteScout PDF SDK for free. It also includes documentation and source code samples.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Program.cs
      
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); } } }

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Explore Samples

Sign Up for ByteScout PDF SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next