Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django 如何在linux系统中使用Xhtml2PDF转换器?_Django_Django Templates_Django Views - Fatal编程技术网

Django 如何在linux系统中使用Xhtml2PDF转换器?

Django 如何在linux系统中使用Xhtml2PDF转换器?,django,django-templates,django-views,Django,Django Templates,Django Views,我正试图在django中使用xhtml2pdf将html转换为pdf,并在windows中成功地将html转换为pdf,但在linux中,它给了我文件权限错误,尽管我对该文件授予了所有类型的权限。在这里我发布了将html转换为pdf的taht函数,请提前提出任何解决方案,谢谢 def CreatePDF(request): ser_type=request.POST.get("service_type") if ser_type is not None: data=Walle

我正试图在django中使用xhtml2pdf将html转换为pdf,并在windows中成功地将html转换为pdf,但在linux中,它给了我文件权限错误,尽管我对该文件授予了所有类型的权限。在这里我发布了将html转换为pdf的taht函数,请提前提出任何解决方案,谢谢

def CreatePDF(request):
ser_type=request.POST.get("service_type")
if ser_type  is not None:

        data=WalletTransaction.objects.get(order_id=request.POST.get("order_id"),user=request.user)
        c={'data':data,'ser_type':int(ser_type)}
        template = get_template('TransHistoryPdf.html')

        html  = template.render(c)
        file = open('test.pdf', "w+b")
        pisaStatus = pisa.CreatePDF(html.encode('utf-8'), dest=file,
               encoding='utf-8')
        file.seek(0)
        pdf = file.read()
        file.close()            
        return HttpResponse(pdf, 'application/pdf')

是否检查文件夹所有者/权限?是否检查文件夹所有者/权限?