如何创建 PDF 文件并使用 django 打开它们

时间:2021-07-14 14:55:13

标签: python django pdf python-tesseract

嘿,我正在使用 django 创建 OCR 应用程序并将 OCR 结果保存到 pdf 文件中,但是每当我尝试打开文件时,我都无法打开此文件,除非我无法查看它在 vscode 上。如果我将文件格式更改为文本,那么我就可以打开它们,我真的不知道问题所在,所以有什么帮助吗? 在这里,我检查图像是否已上传以创建文件,而创建 pdf 只是在图像上运行 pytesseract 的函数

  if self.id :
                 File.objects.create(
                 file=(ContentFile(Create_Pdf(self.image),name='file.pdf')
                ))

enter image description here

0 个答案:

没有答案