Created
August 23, 2023 16:26
-
-
Save rxw1/fbb00aa4d281bf63ec7ca158f61d01f3 to your computer and use it in GitHub Desktop.
Revisions
-
rxw1 created this gist
Aug 23, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,22 @@ from sys import argv from pikepdf import Name, Pdf def render(input: str, output: str) -> None: with Pdf.open(input) as pdf: for page in pdf.pages: annots = page.get("/Annots") if annots is not None: for annot in [ a for a in annots.as_list() if a.Subtype == Name("/Widget") and hasattr(a, "FT") ]: if annot.FT == Name("/Tx"): annot.DA = "/Helv 10 Tf 0 g" pdf.save(output) if __name__ == "__main__": render(argv[1], argv[2])