add some restriction

git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@22 1aa58f4a-7d42-0410-adbc-911cccaed67c
pull/1/head
yusuke.shinyama.dummy 2008-04-27 04:34:41 +00:00
parent 6183469f11
commit ecaf68efed
2 changed files with 3 additions and 1 deletions

1
lzw.py
View File

@ -17,7 +17,6 @@ class LZWDecoder:
return
def readbits(self, bits):
bits0 = bits
v = 0
while 1:
# the number of remaining bits we can get from the current buffer.

View File

@ -163,11 +163,14 @@ class TextConverter(PDFDevice):
# pdf2txt
class TextExtractionNotAllowed(RuntimeError): pass
def pdf2txt(outfp, rsrc, fname, pages, codec, debug=0):
device = TextConverter(rsrc, debug=debug)
doc = PDFDocument(debug=debug)
fp = file(fname)
parser = PDFParser(doc, fp, debug=debug)
if not doc.is_extractable:
raise TextExtractionNotAllowed('text extraction is not allowed: %r' % fname)
interpreter = PDFPageInterpreter(rsrc, device, debug=debug)
outfp.write('<document>\n')
for (i,page) in enumerate(doc.get_pages(debug=debug)):