ByteScout simple and easy to understand tutorials are planned to describe the code for both C# beginners and advanced programmers. ByteScout PDF Suite is the set that includes 6 SDK products 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 sign pdf and set security with pdf sdk in C#.
Want to save time? You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout PDF Suite for sign pdf and set security with pdf sdk below and use it in your application. Follow the instructions from scratch to work and copy the C# code. If you want to use these C# sample examples in one or many applications then they can be used easily.
All these programming tutorials along with source code samples and ByteScout free trial version are available for download from our website.
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.Diagnostics; using System.Drawing; using Bytescout.PDF; using Font = Bytescout.PDF.Font; using SolidBrush = Bytescout.PDF.SolidBrush; using StringFormat = Bytescout.PDF.StringFormat; namespace Signing { /// <summary> /// This example demonstrates how to digitally sign PDF 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); // Add sample page content SolidBrush brush = new SolidBrush(); Font font = new Font("Arial", 16); RectangleF rect = new RectangleF(0, 50, page.Width, 100); StringFormat stringFormat = new StringFormat(); stringFormat.HorizontalAlign = HorizontalAlign.Center; page.Canvas.DrawString("Signature Test", font, brush, rect, stringFormat); // Signing parameters string certficateFile = ".\\demo_certificate.pfx"; string certficatePassword = "123"; // Optional parameters string signingReason = "Approval"; string contactName = "John Smith"; string location = "Corporate HQ"; // Invisible signature //pdfDocument.Sign(certficateFile, certficatePassword); // Visible signature RectangleF signatureRect = new RectangleF(400, 50, 150, 100); pdfDocument.Sign(certficateFile, certficatePassword, signatureRect, signingReason, contactName, location); // 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: