Draw a Line on PDF with C# REST API

This tutorial guides you on how to draw a line on PDF with C# REST API. You will learn to automatically add lines to PDF document with C# RESTful Service using the .NET-based Cloud SDK. It will share the properties and methods to customize the lines while drawing in the PDF.

Prerequisite

Steps to Add Line in PDF with C# Low Code API

  1. Create the PdfApi object with the required key and SID for drawing lines
  2. Create the LineAnnotation object and set the desired parameters
  3. Upload the PDF file to the Cloud storage for inserting lines
  4. Call the PostPageLineAnnotations() method to draw a line in the PDF
  5. Download the updated PDF file with lines in it

These steps describe how to add lines to pdf with C# REST Interface. Create an instance of the PdfAp class by setting the required properties, instantiate a LineAnnotation object by setting the rectangle, color, starting point with style, ending point with style, creation date, and modification date. Upload the PDF file and call the PostPageLineAnnotations() method to draw lines.

Code to Draw Lines on PDF with C# Low Code API

This code demonstrates how to draw a line on a PDF with C# .NET-based API. You can set the intent, caption position, show caption flag, leader line offset, leader line extension, leader line, and interior color. The Rect variable should be initialized as it is required, the starting and ending points define the start and terminal points of the line.

This article has taught us to draw lines in a PDF file. If you want to highlight contents in a PDF file, refer to the article on Highlight PDF Document with C# REST API.

 English