Add Header to PDF with C# REST API

This tutorial guides how to add header to PDF with C# REST API. You will learn to automatically insert a header in PDF with C# Low Code API using a .NET-based Cloud SDK. It will assist you in setting and customizing the header contents including the formatting and positioning.

Prerequisite

Steps to Add Header to PDF Document with C# RESTful Service

  1. Configure the PdfApi by setting the API key and application SID for adding a header
  2. Upload the target PDF file to cloud storage for working with the headers
  3. Create the TextHeader object and set the desired attributes including the text
  4. Call the PostDocumentTextHeader() method to insert the header in the PDF file
  5. Download the PDF file with headers in it

These steps define the process to add header to PDF file with C# REST Interface. Create the PdfApi class object, load the source PDF file to the Cloud, and create a TextHeader object by setting the text alignment, header alignment, text state, color, font, and header text. Call the PostDocumentTextHeader() method to insert the header and save the output PDF file with the new header.

Code to Insert Header in PDF with C# .NET-based API

This code has demonstrated the process to add a header to PDF with C# RESTful Service. The TextHeader contains other features such as links, background, opacity, flag to rotate, rotation angle, and zoom. Similarly, you can set the margin from the top, left, and right, underline, strikethrough, superscript, and subscript state of header text.

This article has taught us how to work with headers in a PDF file. To insert an image in a PDF file, refer to the article on Insert Image into PDF with C# REST API.

 English