Created
September 27, 2013 10:56
-
-
Save phretor/6726953 to your computer and use it in GitHub Desktop.
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
#! /usr/bin/env python | |
import sys | |
import argparse | |
import subprocess | |
import shlex | |
def main(): | |
parser = argparse.ArgumentParser( | |
description='Takes a PDF and attempts to embed the fonts.') | |
parser.add_argument('-p', help='Paper size', default='a4') | |
parser.add_argument('input_file', help='The input PDF') | |
parser.add_argument('output_file', help='The output PDF') | |
args = parser.parse_args() | |
cl = 'gs -dSAFER -dNOPLATFONTS -dNOPAUSE -dBATCH -sDEVICE=pdfwrite'\ | |
' -sPAPERSIZE=%s -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer'\ | |
' -dCompatibilityLevel=1.4 -dMaxSubsetPct=100 -dSubsetFonts=true'\ | |
' -dEmbedAllFonts=true -sOutputFile="%s" -f "%s"' % ( | |
args.p, args.output_file, args.input_file) | |
return subprocess.Popen(shlex.split(cl)) | |
if __name__ == '__main__': | |
sys.exit(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment