A signed PDF/A-1b file from Python in 40 lines, no compiled extension
Most PDF libraries for Python can write a PDF. Far fewer can produce a file that a validator accepts as PDF/A-1b , and fewer still can put a digital signature on it without shelling out to a second tool. Here is the whole job in one script, using the LumasPDF SDK through its Python wheel. The binding is ctypes over a native engine, so there is nothing to compile. Disclosure: I'm the author of LumasPDF. Install pip install lumaspdf Wheels exist for Windows x64/x86, Linux x64 and macOS. The engine for your platform is inside the wheel. The download is free; unlicensed output carries an evaluation watermark, and a trial key removes it. You also need two files: an sRGB ICC profile and a PKCS#12 certificate. Both ship as test fixtures in the SDK download ( test_files/sample_rgb.icc and test_files/test_cert.pfx , password 123456 ), or use your own. The script """ Create a PDF/A-1b file and sign it, from Python, with the lumaspdf wheel. pip install lumaspdf python signed_pdfa.py sRGB.icc cert.pfx cert-password """ import os , sys , ctypes import lumaspdf as L icc , pfx , pwd = sys . argv [ 1 ], sys . argv [ 2 ], sys . argv [ 3 ] out = os . path . abspath ( " signed_pdfa.pdf " ) # Errors arrive through a callback; return 0 to let CheckConformance apply fixes. ERR = ctypes . WINFUNCTYPE if os . name == " nt " else ctypes . CFUNCTYPE @ERR ( ctypes . c_int32 , ctypes . c_void_p , ctypes . c_int32 , ctypes . c_char_p , ctypes . c_int32 ) def on_error ( data , code , msg , kind ): print ( " engine: " , msg . decode ( " latin-1 " , " replace " )) return 0 pdf = L . pdfNewPDF () L . pdfSetOnErrorProc ( pdf , 0 , on_error ) L . pdfCreateNewPDFA ( pdf , b "" ) # output file is chosen at the end L . pdfSetDocInfoA ( pdf , L . diTitle , b " Signed PDF/A-1b from Python " ) L . pdfAppend ( pdf ) # PDF/A needs every font embedded, so use a real TrueType face, not a base-14 name. L . pdfSetFontA ( pdf , b " Arial " , L . fsNone , 11.0 , 1 , L . cp1252 ) L . pdfWriteFTextA ( pdf , L . taLe