lundi 14 avril 2014

pdf2htmlEX is not recognized in the py script


Vote count:

0




In the cmd I type the following to run the test script provided in pdf2htmlEX as :


python test.py


It is giving me the following error:


'pdf2htmlEX' is not recognised as an internal or external command, operable program or batch file.


The test.py script is as follows:



#!/usr/bin/env python


DIR = 'test_data'



import os
import sys


with open('out2.html','w') as outf:
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;">')

for f in os.listdir(DIR):
if not f.lower().endswith('.pdf'):
continue
print f
if os.system('pdf2htmlEX -l 10 --no-drm 1 --fit-width 1024 --dest-dir html --external-hint-tool="ttfautohint" "%s/%s"' % (DIR,f)) != 0:
print "error on ", f
sys.exit(-1)

ff = f[:-3]
outf.write('<a href="html/%shtml" target="pdf">%s</a><br/>' % (ff,ff))
outf.flush();

outf.write('</div></body></html>')


The test-data directory contains pages-2.pdf file. Why am I getting the error and how can I successfully run this script?



asked 3 mins ago






Aucun commentaire:

Enregistrer un commentaire