Skip to content

Python utility to add links to a PDF, PyMuPDF-based

Notifications You must be signed in to change notification settings

corbin-c/pyPDFLink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

pyPDFLink

Python utility to add links to a PDF. Just a small script using PyMuPDF.

Installation

git clone git@https://github.com/corbin-c/pyPDFLink.git
cd pyPDFLink
pip install pymupdf

Usage

python PDFLink.py input_file.pdf links_dump output_file.pdf

Links description

Only hyperlinks are supported. Links must be described in a text file, structured as TSV: First column is the "clickable box" rectangle definition, as x0,y0,x1,y1, second column is the destination URI, third is the page.

Example:

27,293,104,307	tel:+43245676432	0
27,312,160,327	mailto:first.last@gmail.com	1
216,573,326,587	https://coolwebsite.com/	3

Why this tool?

When using Firefox to generate a PDF from a web page, it comes without hyperlinks. This tool can be used to add the links where they should be. To avoid manually describing the box & uri for each hyperlink to activate, a JS bookmarklet is provided (see file bkmlt.js; currently only supports 1-page files).

About

Python utility to add links to a PDF, PyMuPDF-based

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published