ByteScout PDF Suite - C# - Add show hide action to pdf with pdf sdk - ByteScout

ByteScout PDF Suite – C# – Add show hide action to pdf with pdf sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF Suite – C# – Add show hide action to pdf with pdf sdk

How to add show hide action to pdf with pdf sdk in C# using ByteScout PDF Suite

Learn to code in C# to add show hide action to pdf with pdf sdk with this step-by-step tutorial

This sample source code below will display you how to add show hide action to pdf with pdf sdk in C#. 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 show hide action to pdf with pdf sdk in your C# application.

The following code snippet for ByteScout PDF Suite works best when you need to quickly add show hide action to pdf with pdf sdk in your C# application. Just copy and paste the code into your C# application’s code and follow the instructions. Want to see how it works with your data then code testing will allow the function to be tested and work properly.

Trial version of ByteScout PDF Suite is available for free. Source code samples are included to help you with your C# app.

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.Diagnostics; using Bytescout.PDF; namespace ShowHideWidget { /// <summary> /// This example demonstrates how to show/hide a widget in document. /// </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 widget that will be shown/hidden EditBox editBox = new EditBox(20, 20, 100, 25, "editBox1"); editBox.Text = "editBox1"; page.Annotations.Add(editBox); // Create button that will show the widget PushButton buttonShow = new PushButton(20, 80, 50, 25, "buttonShow"); buttonShow.Caption = "Show"; page.Annotations.Add(buttonShow); // Add Show action HideAction showAction = new HideAction(false); showAction.Fields.Add(editBox); buttonShow.OnActivated = showAction; // Create button that will hide the widget PushButton buttonHide = new PushButton(100, 80, 50, 25, "buttonHide"); buttonHide.Caption = "Hide"; page.Annotations.Add(buttonHide); // Add Hide action HideAction hideAction = new HideAction(true); hideAction.Fields.Add(editBox); buttonHide.OnActivated = hideAction; // 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 Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite 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 Suite Home Page

Explore ByteScout PDF Suite Documentation

Explore Samples

Sign Up for ByteScout PDF Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next