commit 975e6056a8344aafb0556965b3e2eeb15e61827c parent 8edcfdec99b8321ddd656de17cbc8bc2968d04b0 Author: Antoine Amarilli <a3nm@a3nm.net> Date: Tue, 22 Feb 2022 17:24:50 +0100 Merge branch 'master' of a3nm.net:git/mybin 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 +