Python: How to Auto Add Watermark to PDF

One line of code, automatically add the watermark content you specify to the PDF file, fast and free.

 

1. Function introduction

Last time we introduced one of the functions of the python-office library: to realize batch Word to PDF, today we introduce the second function of this library:

One line of code, automatically add your specified watermark content to PDF files, fast and free.

2. Code description

download python-office

a. If you are using python-office for the first time,

Just need the following command to automatically download and install python-office

pip install python-office

b. If you have read the previous articles and have downloaded and used python-office,

Then you need to run the following command to upgrade python-office to the latest version.

The update of python-office is very frequent. It is recommended that you update it every time you use it~

pip install --upgrade python-office

call function

After installing python-office, copy and paste directly and run the following code

import office  # import python-office

office.pdf.add_watermark() # No need to make any changes to the code, just run

After running, some prompt text will appear in the console. The python-office developed by the Chinese, of course, the prompt text is Chinese.

You can directly enter the corresponding content according to your own needs, and the program will automatically add a watermark. As shown below.

3. About python-office

python-office is an open source third-party library of pypi, designed for python automation office.

You are also welcome to participate in the construction of the open source project python-office. The open source warehouse address:

  • GitHub:  CoderWanFeng/python-office

Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *