|
26 | 26 | content = line.split(': ')[0] |
27 | 27 | print(f'Trying "{content}" ({i})') |
28 | 28 | if exists(f'../speeches/{content}.md'): |
29 | | - run(['pandoc', ('../speeches/%s.md' % content), '-V', 'geometry:papersize={ 6in, 10.3in }', '-V', 'geometry:margin=0.5in', '-o', f'{outd}/{i}.pdf'], check=True) |
| 29 | + run(['pandoc', ('../speeches/%s.md' % content), '-V', 'geometry:papersize={ 8.5in, 14in }', '-V', 'geometry:margin=0.5in', '-V', 'fontsize=17pt','-V', 'documentclass=extarticle', '-o', f'{outd}/{i}.pdf'], check=True) |
30 | 30 | continue |
31 | 31 | g=glob(f'../songs/{content}/*-chord-chart.pdf') |
32 | 32 | if g: |
|
45 | 45 | if fn.endswith('.pdf'): |
46 | 46 | run(['cp', fn, f'{outd}/{i}.pdf'], check=True) |
47 | 47 | found=True |
48 | | - elif fn.endswith('.html') or fn.endswith('.txt') : |
| 48 | + elif fn.endswith('.txt') : |
| 49 | + thtmlfn = f'{outd}/{i}.html' |
| 50 | + with open(thtmlfn,'w') as thtmlf: |
| 51 | + thtmlf.write('<html><head><style> @page { size:legal } body { font-size: 14pt; } </style></head><body><pre>') |
| 52 | + thtmlf.write(open(fn).read()) |
| 53 | + thtmlf.write('</pre></body></html>') |
| 54 | + run(['google-chrome', '--headless', '--disable-gpu', f'--print-to-pdf={outd}/{i}.pdf', thtmlfn], check=True) |
| 55 | + found=True |
| 56 | + elif fn.endswith('.html'): |
49 | 57 | run(['google-chrome', '--headless', '--disable-gpu', f'--print-to-pdf={outd}/{i}.pdf', fn], check=True) |
50 | 58 | found=True |
51 | 59 | else: |
|
55 | 63 | break |
56 | 64 | else: |
57 | 65 | print(f'WARNING: skipping {content}') |
58 | | - |
| 66 | + |
59 | 67 | run(['gs', '-dNOPAUSE', '-sDEVICE=pdfwrite', f'-sOUTPUTFILE={sys.argv[1]}.pdf', '-dBATCH'] + [ f'{outd}/{j}.pdf' for j in range(1,i+1) ], check=True) |
60 | 68 | print(outd) |
61 | 69 | remove(cssfn) |
0 commit comments