mybin

my ~/bin
git clone https://a3nm.net/git/mybin/
Log | Files | Refs | README

commit ffe4bf98a524769edede3bf057c075701cbdb9df
parent a99d5d0f70911352fc63b0b7fb666c16d5b7146b
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Fri, 28 Jan 2022 20:08:02 +0100

pdfdump

Diffstat:
pdfdump | 23+++++++++++++++++++++++
1 file changed, 23 insertions(+), 0 deletions(-)

diff --git a/pdfdump b/pdfdump @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# https://stackoverflow.com/a/54823050 +# by https://stackoverflow.com/users/2747626/mxl + +import sys +import PyPDF2, traceback + +src = sys.argv[1] + +input1 = PyPDF2.PdfFileReader(open(src, "rb")) +nPages = input1.getNumPages() + +for i in range(nPages) : + page0 = input1.getPage(i) + try : + for annot in page0['/Annots'] : + print (annot.getObject()) # (1) + print ('') + except : + # there are no annotations on this page + pass +