How to Put a Line Through Text in PDF

In today’s digital landscape, the ability to programmatically apply strikethrough formatting to text within PDF documents is crucial. By leveraging Node.js and REST API, developers can seamlessly incorporate this feature into their applications. This article explores How to put a line through text in a PDF using Node.js and REST API, offering a concise guide for enhancing PDF manipulation capabilities.

Step 1: Installing Node.js Strikethrough Text Creator SDK

For strikethrough the text in PDF files, we will use the Node.js SDK of GroupDocs.Annotation Cloud API. It allows adding annotations, watermark overlays, text replacements, redactions, and text markups to the supported document formats. Please install it using the following command in the console:

npm install groupdocs-annotation-cloud

Step 2: Initialize the API Client

To initialize the API client, please get your Client ID and Client Secret from the dashboard and add the code as shown below:

Step 3: Uploading the Document

Before diving in, you need to upload the PDF document to which you want to make the strikeout text. Upload the document to the cloud storage using any of the following methods:

  • Using the dashboard.
  • Upload all files one by one using Upload File API from the browser.
  • Upload programmatically using the code example given below:

As a result, the uploaded files will be available in the [files section][] of your dashboard on the cloud.

Step 4: Strikethrough Text in PDF using Node.js SDK

The following steps and sample code shows how to strikethrough Text in a PDF using Node.js SDK.

  1. First, initialize the AnnotateApi instance using the provided client ID and client secret.
  2. Then, create a new AnnotationInfo object.
  3. Next, create four Point objects: p1, p2, p3, and p4, and set their x and y coordinates.
  4. Then, add the four points to the AnnotationInfo object.
  5. Next, set the page number for the annotation.
  6. Then, set the font color and font size for the annotation.
  7. Next, specify the annotation type as TextStrikeout and set the text content of the annotation.
  8. Then, set the creator name for the annotation.
  9. Next, create a new FileInfo object and set the file path to the input file.
  10. Then, create an AnnotateOptions object and set the FileInfo object and the AnnotationInfo object created above.
  11. Next, set the output path for the annotated file.
  12. Then, call the annotate method on the AnnotateApi instance with the AnnotateOptions object as a parameter and store the result in a variable.
  13. Finally, print the URL of the annotated file from the result to the console.

The following code example shows how to strike out Text in PDF using Node.js SDK.

The output will be like the following screenshot:

Strikethrough in PDF

Step 5: Download Resultant File

The code given in the previous step saves the resultant file on the cloud. To download it, you can use the following code snippet.


How can I strikethrough text in a PDF using Node.js and REST API?

A: To strikethrough text in a PDF using Node.js and REST API, you can follow the steps as given above.

Can I customize the appearance of the strikethrough text annotation?

Yes, you can customize the appearance of the strikethrough text annotation. With the API, you can set properties such as the strikethrough text color and thickness. You can adjust these properties according to your requirements to achieve the desired visual effect.

Does the Node.js and REST API solution support batch processing of PDF documents?

Yes, the Node.js and REST API solution supports batch processing of PDF documents. You can pass multiple PDF files to the API and apply strikethrough text annotations to each document in the batch.

Is it possible to strikethrough text in specific pages of a PDF document?

Absolutely! You can specify the page numbers in the API request to apply strikethrough text annotations to specific pages of a PDF document.


In a nutshell, simplifying the process of adding strikethrough text annotations to PDFs is made possible by integrating Node.js with REST API. Utilize the strength of Node.js to improve your ability to annotate PDFs with strikethrough text.

Furthermore, you can see an API reference section that allows you to visualize and interact with our APIs directly through the browser. Node.js SDK’s complete source code is freely available on Github.

Finally, we keep writing new blog articles on different file formats and parsing them using REST API. So, please get in touch for the latest updates. Happy coding!

Free Online PDF Strikethrough Text Creator

To strikethrough text in a PDF online for free. Please try an online PDF strikethrough text maker app. This PDF text strikeout creator app is developed using the above-mentioned PDF strikethrough text creator REST API.

Ask a question

In case you would have any queries or confusion about the PDF strikethrough, please feel free to contact us via our forum.

See Also

Here are some related articles that you may find helpful: