How to Modify PDF File and Add Watermark Text in Deno Using PDF-LIB Library Full Tutorial With Example

You are currently viewing How to Modify PDF File and Add Watermark Text in Deno Using PDF-LIB Library Full Tutorial With Example

 

Welcome folks today in this tutorial we will be modifying pdf file and adding watermark text using pdf-lib. The full source code of the example is given below.

 

 

Requirements

 

 

You should have Deno installed on your system

 

 

Get Started

 

 

In order to get started you need to create a app.ts file and copy paste the following code

 

 

app.ts

 

 

 

 

 

 

 

Now if you execute this deno script by executing this following command which is shown below

 

deno run --allow-write --allow-net app.ts

 

In this command there are two flags out there

 

--allow-write This flag is required to create new files inside the system

 

--allow-net` This flag is required for deno scripts to have internet access

 

 

Now if you execute this after this you will have modified.pdf created in the root directory

 

 

 

 

If you open this modified.pdf file you will see the following thing

 

 

 

 

 

 

Leave a Reply