-
-
Save mazulo/1ffa79d611d096771dd602ef680a9ac7 to your computer and use it in GitHub Desktop.
Script que mostra os fields editáveis do form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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