add -n option to pdf2txt.py

git-svn-id: https://pdfminerr.googlecode.com/svn/trunk/pdfminer@157 1aa58f4a-7d42-0410-adbc-911cccaed67c
pull/1/head
yusuke.shinyama.dummy 2009-11-07 09:12:54 +00:00
parent faa775897c
commit 61d4872c3a
2 changed files with 7 additions and 3 deletions

View File

@ -19,7 +19,7 @@ Python PDF parser and analyzer
<div align=right class=lastmod> <div align=right class=lastmod>
<!-- hhmts start --> <!-- hhmts start -->
Last Modified: Thu Nov 5 22:23:07 JST 2009 Last Modified: Sat Nov 7 18:11:40 JST 2009
<!-- hhmts end --> <!-- hhmts end -->
</div> </div>
@ -259,6 +259,9 @@ are M = 1.0, L = 0.3, and W = 0.2, respectively.
<td style="border-top:1px blue solid" align=right>&uarr;</td> <td style="border-top:1px blue solid" align=right>&uarr;</td>
</tr></table> </tr></table>
<p> <p>
<dt> <code>-n</code>
<dd> Suppress layout analysis.
<p>
<dt> <code>-s <em>scale</em></code> <dt> <code>-s <em>scale</em></code>
<dd> Specifies the output scale. Can be used in HTML format only. <dd> Specifies the output scale. Can be used in HTML format only.
<p> <p>

View File

@ -12,11 +12,11 @@ def main(argv):
import getopt import getopt
def usage(): def usage():
print ('usage: %s [-d] [-p pagenos] [-P password] [-c codec] ' print ('usage: %s [-d] [-p pagenos] [-P password] [-c codec] '
'[-D direction] [-M char_margin] [-L line_margin] [-W word_margin] ' '[-n] [-D direction] [-M char_margin] [-L line_margin] [-W word_margin] '
'[-t text|html|xml|tag] [-o output] file ...' % argv[0]) '[-t text|html|xml|tag] [-o output] file ...' % argv[0])
return 100 return 100
try: try:
(opts, args) = getopt.getopt(argv[1:], 'dp:P:c:D:M:L:W:t:o:C:D:m:') (opts, args) = getopt.getopt(argv[1:], 'dp:P:c:nD:M:L:W:t:o:C:D:m:')
except getopt.GetoptError: except getopt.GetoptError:
return usage() return usage()
if not args: return usage() if not args: return usage()
@ -46,6 +46,7 @@ def main(argv):
elif k == '-c': codec = v elif k == '-c': codec = v
elif k == '-o': outfile = v elif k == '-o': outfile = v
elif k == '-s': scale = float(v) elif k == '-s': scale = float(v)
elif k == '-n': laparams = None
elif k == '-D': laparams.direction = v elif k == '-D': laparams.direction = v
elif k == '-M': laparams.char_margin = float(v) elif k == '-M': laparams.char_margin = float(v)
elif k == '-L': laparams.line_margin = float(v) elif k == '-L': laparams.line_margin = float(v)