简化打印代码
This commit is contained in:
@@ -128,15 +128,15 @@ class JikimoPrinting(models.AbstractModel):
|
||||
return
|
||||
|
||||
# 使用正确的格式打印
|
||||
try:
|
||||
if is_pdf:
|
||||
_logger.info("使用PDF格式打印")
|
||||
printer.print_document(report=None, content=pdf_content, doc_format='pdf')
|
||||
else:
|
||||
_logger.info("使用RAW格式打印")
|
||||
printer.print_document(report=None, content=pdf_content, doc_format='raw')
|
||||
except Exception as e:
|
||||
_logger.error(f"打印时出错: {str(e)}")
|
||||
# try:
|
||||
# if is_pdf:
|
||||
# _logger.info("使用PDF格式打印")
|
||||
printer.print_document(report=None, content=pdf_content, doc_format='pdf')
|
||||
# else:
|
||||
# _logger.info("使用RAW格式打印")
|
||||
# printer.print_document(report=None, content=pdf_content, doc_format='raw')
|
||||
# except Exception as e:
|
||||
# _logger.error(f"打印时出错: {str(e)}")
|
||||
|
||||
# 清理资源
|
||||
pdf_buffer.close()
|
||||
|
||||
Reference in New Issue
Block a user