Code change:
Project description From the project page: A tool to sign PDF files with Linux support. Why There appears to be a lack of applications that run on Linux and allow for attaching free-hand signatures to PDF files in a good way. (Non-)alternatives include: Xournal and Xournal++: Allows free-hand annotations but not saving those for later use. Allows inserting images and .pdf files but will rasterize them rather than retain the vector graphics, resulting in lower quality. LibreOffice Draw: Allows inserting images and .pdf files but will rasterize them rather than retain the vector graphics, resulting in lower quality. Okular: Allows free-hand annotations but not saving those for later use. Allows inserting custom saved stamps, but these will not be visible in other PDF readers. Evince: Allows certain kinds of annotations, but nothing that can look like a free-hand signature. pdftk, Ghostscript, and other command-line tools: Allows superimposing .pdf files, but not interactively selecting where. Metadata homepage URL: source URL: license: MIT platforms: linux
Working on it

Related discussion:
text: <ins> diff --git a/pdf-create-empty b/pdf-create-empty index e4768af..5caf34c 100755 --- a/pdf-create-empty +++ b/pdf-create-empty @@ -20,7 +20,7 @@ def main(args): except: die('Invalid dimensions') subprocess.run([ -        'gs', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-dQUIET', +        '@gs@', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-dQUIET', f'-sOutputFile={o}', '-sDEVICE=pdfwrite', f'-dDEVICEWIDTHPOINTS={w}', f'-dDEVICEHEIGHTPOINTS={h}', diff --git a/pdf-sign b/pdf-sign index 64be231..37d508d 100755 --- a/pdf-sign +++ b/pdf-sign @@ -17,7 +17,7 @@ def main(args): if args.flatten: outFile=intmp('input.pdf') subprocess.run([ -                    'pdftk', filePath, +                    '@pdftk@', filePath, 'output', outFile, 'flatten' ], check=True) @@ -28,7 +28,7 @@ def main(args): if args.page < -pageCount or args.page==0 or pageCount < args.page: die('Page number out of range') pageNumber=Cell(args.page if 0 < args.page else pageCount+args.page+1) -        pagePDF=Cell(lambda: subprocess.run(['pdftk', inputPDF(), 'cat', str(pageNumber()), 'output', intmp('page.pdf')], check=True) and intmp('page.pdf')) +        pagePDF=Cell(lambda: subprocess.run(['@pdftk@', inputPDF(), 'cat', str(pageNumber()), 'output', intmp('page.pdf')], check=True) and intmp('page.pdf')) pageSize=Cell(lambda: pdfGetSize(pagePDF())) # The chosen signature if not args.signature and args.batch: @@ -52,7 +52,7 @@ def main(args): dy=h*(1-signaturePositionY())/resize - sh/2 outFile=intmp('signature-positioned.pdf') subprocess.run([ -                'gs', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-dQUIET', +                '@gs@', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-dQUIET', f'-sOutputFile={outFile}', '-sDEVICE=pdfwrite', f'-dDEVICEWIDTHPOINTS={w}', f'-dDEVICEHEIGHTPOINTS={h}', '-dFIXEDMEDIA', @@ -62,7 +62,7 @@ def main(args): return outFile # The signed page signedPagePDF=Cell(lambda: subprocess.run([ -            'pdftk', +            '@pdftk@', pagePDF(), 'stamp', signaturePositionedPDF(), 'output', intmp('signed-page.pdf'), @@ -80,7 +80,7 @@ def main(args): (w, h)=displaySize() outFile=intmp('display.png') subprocess.run([ -                'gs', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-dQUIET', +                '@gs@', '-dBATCH', '-dNOPAUSE', '-dSAFER', '-dQUIET', f'-sOutputFile={outFile}', '-sDEVICE=pngalpha', '-dMaxBitmap=2147483647', @@ -258,7 +258,7 @@ def main(args): if args.existing=='backup': backupFilePath=f'{signedFilePath}.backup{time.strftime("%Y%m%d_%H%M%S")}' subprocess.run([ -                        'mv', +                        '@mv@', signedFilePath, backupFilePath, ], check=True) @@ -269,7 +269,7 @@ def main(args): assert args.existing=='overwrite' pnr=pageNumber() subprocess.run([ -                'pdftk', +                '@pdftk@', f'A={inputPDF()}', f'B={signedPagePDF()}', 'cat', @@ -352,10 +352,10 @@ def tkthrottle(frequency, root): return decorator def pdfCountPages(filePath): -    return int(fromCmdOutput(["pdfinfo", filePath], "^.*nPages: +([0-9]+)n.*$")[1]) +    return int(fromCmdOutput(["@pdfinfo@", filePath], "^.*nPages: +([0-9]+)n.*$")[1]) def pdfGetSize(filePath): -    [ignored, w, h, *ignored2]=fromCmdOutput(['pdfinfo', filePath], '^.*nPage size: +([0-9.]+) x ([0-9.]+) pts( ([A-Za-z0-9]+))?n.*$') +    [ignored, w, h, *ignored2]=fromCmdOutput(['@pdfinfo@', filePath], '^.*nPage size: +([0-9.]+) x ([0-9.]+) pts( ([A-Za-z0-9]+))?n.*$') return (float(w), float(h)) def m(pattern, string): </ins>