1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-07-05 09:38:40 +00:00
pdf2htmlEX/test/test.py

26 lines
1.0 KiB
Python
Raw Normal View History

2012-08-27 08:34:06 +00:00
#!/usr/bin/env python
2012-08-27 17:57:39 +00:00
DIR = 'pdf'
2012-10-06 11:20:35 +00:00
#DIR = '../../pdf.js/test/pdfs'
2012-08-27 17:57:39 +00:00
2012-08-27 08:34:06 +00:00
import os
2012-10-06 12:25:11 +00:00
import sys
2012-08-27 08:34:06 +00:00
2012-09-07 17:45:38 +00:00
with open('out.html','w') as outf:
2012-09-21 08:51:13 +00:00
outf.write('<!DOCTYPE html>\n<html><head><meta charset=\"utf-8\"></head><body><div style="position:absolute;top:0;left:0;width:80%;height:100%;"><iframe width="100%" height="100%" name="pdf"></iframe></div><div style="position:absolute;top:0;right:0;width:20%;height:100%;overflow:auto;text-align:right;">')
2012-08-27 08:34:06 +00:00
2012-09-07 17:45:38 +00:00
for f in os.listdir(DIR):
if not f.lower().endswith('.pdf'):
continue
print f
2013-03-24 09:18:13 +00:00
if os.system('pdf2htmlEX -l 10 --no-drm 1 --fit-width 1024 --dest-dir html --auto-hint=1 --external-hint-tool="ttfautohint" "%s/%s"' % (DIR,f)) != 0:
2012-10-06 12:25:11 +00:00
print "error on ", f
sys.exit(-1)
2012-10-05 15:38:17 +00:00
#os.system('pdf2htmlEX --dest-dir html --process-nontext 0 --css-draw 1 "%s/%s"' % (DIR,f))
2012-09-07 17:45:38 +00:00
ff = f[:-3]
outf.write('<a href="html/%shtml" target="pdf">%s</a><br/>' % (ff,ff))
outf.flush();
2012-08-27 08:34:06 +00:00
2012-09-07 17:45:38 +00:00
outf.write('</div></body></html>')