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
- Create an account API credentials
- Download Aspose.PDF Cloud SDK for Dotnet to strikeout text in a PDF file
- Setup C# project with the above SDK for striking through text
Steps to Add Line in PDF with C# Low Code API
- Create the PdfApi object with the required key and SID for drawing lines
- Create the LineAnnotation object and set the desired parameters
- Upload the PDF file to the Cloud storage for inserting lines
- Call the PostPageLineAnnotations() method to draw a line in the PDF
- 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.