Examples

Adding the Annotation Show Hide Action to a PDF

Adding the Annotation Show Hide Action to a PDF using DynamicPDF Core Suite is straight forward.

How to Add the Annotation Show Hide Action to PDF in C#

The following steps and code illustrates adding an Annotation Show Hide Action to a PDF document using DynamicPDF Core Suite. Use these actions to perform tasks in many places such as in outlines, links, buttons or in any Document, Page or Form Field Reader Events. You can also use these actions to show/hide a specific form field.

Steps for Adding Annotation Show Hide Action to a PDF Document

  1. Create a Document object.
  2. Create a Page object and add it to the Document instance.
  3. Create a Button object.
  4. Create a TextField object.
  5. Create a AnnotationShowHideAction object.
  6. Associate the action to the button by setting the Button instance's ReaderEvents.MouseDown event.
  7. Add the Button to the Page instance.
  8. Save the PDF document.

Sample Code - C#

Document document = new Document();
Page page = new Page();
document.Pages.Add( page );

Button button = new Button("btn", 50, 150, 100, 30);
button.Label = "Click Here";
ceTe.DynamicPDF.PageElements.Forms.TextField field = new ceTe.DynamicPDF.PageElements.Forms.TextField("Text1", 330, 100, 100, 30);
field.DefaultValue = "Text Field Value"; 
AnnotationShowHideAction action = new AnnotationShowHideAction("Text1");
button.ReaderEvents.MouseDown = action;  

page.Elements.Add( button );	
document.Draw(@"Output.pdf");

GitHub Project

Clone or view the example project at GitHub. This example code is contained in the Examples/AnnotationsExample.cs file.

Clone or View Example Project on GitHub

Getting Started

NuGet Package

DynamicPDF Core Suite is available on NuGet and is part of the ceTe.DynamicPDF.CoreSuite.NET package. The easiest way to install the package is by using the Visual Studio Package Manger. You can also download the package directly from NuGet.

NuGet Package ID: ceTe.DynamicPDF.CoreSuite.NET

DynamicPDF Core Suite Information

DynamicPDF Generator contains over 75 page elements you can use to add add rich content to the PDFs you create. DynamicPDF Core Suite includes elements to add:

  • Text Objects (TextArea and Label),
  • HTML,
  • Barcodes (47 types),
  • Form Fields,
  • and Charts.

Refer to the DynamicPDF Core Suite website for more information.

Available on Other platforms

DynamicPDF Core Suite is also available for the following platforms. Refer to the respective product pages for more details.

Why Choose DynamicPDF?

  • Transparent Pricing
  • Lots of Features
  • Easy to Use
  • Great Support
  • Efficient Performance
  • Product Maturity (Over 22 Years)
  • Free Evaluation
  • .NET Core Support (Most Products)
  • Flexible Licensing

We’re Not The Only Ones That Think We’re Great!