Support passing MIMETypes and actual document filenames to TextParser for better lexer guessing

This commit is contained in:
Roberto Rosario
2012-08-06 03:00:09 -04:00
parent 27c0a3ef43
commit 576a2cc643
3 changed files with 39 additions and 15 deletions

View File

@@ -70,7 +70,7 @@ def convert(input_filepath, output_filepath=None, cleanup_files=False, mimetype=
parser_output_filepath = os.path.join(TEMPORARY_DIRECTORY, u''.join([input_filepath, str(page), TEXT_PARSER_FILE_SUFFIX]))
logger.debug('parser_output_filepath: %s', parser_output_filepath)
with open(parser_output_filepath, 'wb') as descriptor:
descriptor.write(text_parser.render_to_image(input_filepath, page_number=page))
descriptor.write(text_parser.render_to_image(input_filepath, mimetype=mimetype, page_number=page))
input_filepath = parser_output_filepath
mimetype = 'image/png'