Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Script que mostra os fields editáveis do form
import os
from pathlib import Path
import pdfrw
ANNOT_KEY = '/Annots'
ANNOT_FIELD_KEY = '/T'
SUBTYPE_KEY = '/Subtype'
WIDGET_SUBTYPE_KEY = '/Widget'
TEMPLATE_PATH = 'Documents/Dunderlabs/Posts/escape.pdf'
template_pdf = pdfrw.PdfReader(os.path.join(Path.home(), TEMPLATE_PATH))
annotations = template_pdf.pages[0][ANNOT_KEY]
for annotation in annotations:
if annotation[SUBTYPE_KEY] == WIDGET_SUBTYPE_KEY:
if annotation[ANNOT_FIELD_KEY]:
key = annotation[ANNOT_FIELD_KEY][1:-1]
print(key)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment