I think you must replace *requst* by *request* on the parameters of your
function createPdf

Le jeu. 11 mai 2023, 18:18, Oduwa Imade <oduwa2...@gmail.com> a écrit :

> Hello everyone, I would like to thank you for your concern and support
> regarding the issue I faced earlier. I am happy to inform you that I was
> able to resolve the error. I discovered that the xhtml2pdf library was
> unable to process or parse an HTML file that contained a table. I'm not
> exactly sure why this was causing an error:
> ValueError at /RecruitmentApp/createcvpdf
> <PmlTable@0x1B92DB31D50 23 rows x 3 cols> with cell(0,0) containing
> '<PmlKeepInFrame at 0x1b92db92e90> size=x' data error - 23 rows in data
> but 22 row heights
>
> To fix the problem, I removed the table element from my HTML file and used
> <div> and <p> elements instead, while also utilizing Django tags for a
> structured layout. I was then able to successfully render the PDF.
>
> On Thursday, May 11, 2023 at 6:54:04 PM UTC+1 Abdulrahman Abbas wrote:
>
>> Send the error details
>>
>> On Thu, May 11, 2023, 14:41 Michael Edet <mich...@gmail.com> wrote:
>>
>>> How???
>>>
>>> On Thu, 11 May 2023, 14:25 Vishesh Mangla, <manglav...@gmail.com> wrote:
>>>
>>>> Try weasyprint
>>>>
>>>> On Thu, 11 May, 2023, 18:38 Oduwa Imade, <oduw...@gmail.com> wrote:
>>>>
>>>>> Hello Guys! I am trying to generate a Pdf doc(reading data from a
>>>>> database) on Django with xhtml2pdf library. but i encounter this error 
>>>>> when
>>>>> i hit the 'Create PDF' button:
>>>>>
>>>>> ValueError at /RecruitmentApp/createcvpdf
>>>>> <PmlTable@0x1B92DB31D50 23 rows x 3 cols> with cell(0,0) containing
>>>>> '<PmlKeepInFrame at 0x1b92db92e90> size=x' data error - 23 rows in
>>>>> data but 22 row heights .
>>>>>  ......am not sure what the error is saying or what am doing wrong.
>>>>> Can anyone assist please with ideas on how to tackle this issue?
>>>>>
>>>>> This is the method in the views.py that handles the pdf creation:
>>>>>
>>>>> def createPdf(requst):
>>>>>           #jobseekerID = request.session['rec_ID']
>>>>>           jobseekerID = 2
>>>>>
>>>>>           cv = CV.objects.select_related('f_key_REC').get(f_key_REC =
>>>>> jobseekerID)
>>>>>           skill = Skill.objects.select_related('fk_sCV').get(fk_sCV =
>>>>> cv.id)
>>>>>           qualification = Qualification.objects.select_related(
>>>>> 'fk_qCV').get(fk_qCV=cv.id)
>>>>>           certification = Certification.objects.select_related(
>>>>> 'fk_cCV').get(fk_cCV = cv.id)
>>>>>           experience = Experience.objects.select_related('fk_eCV').
>>>>> filter(fk_eCV = cv.id)
>>>>>
>>>>>           template_path = 'Recruitment_App/createpdf_cv.html'
>>>>>           context = {
>>>>>                "cv": cv,
>>>>>                "skills" : skill,
>>>>>                "qualifications": qualification,
>>>>>                "certification": certification,
>>>>>                "experience": experience
>>>>>           }
>>>>>           print (cv)
>>>>>           print(skill)
>>>>>           print(experience)
>>>>>           response = HttpResponse(content_type='application/pdf')
>>>>>           response['Content-Disposition'] = 'filename="cv001.pdf"'
>>>>>           template = get_template(template_path)
>>>>>           html = template.render(context)
>>>>>
>>>>>           pisa_status = pisa.CreatePDF(html, dest=response)
>>>>>           print(template)
>>>>>           if pisa_status.err:
>>>>>                return HttpResponse('We had some errors <pre>' + html +
>>>>> '</pre>')
>>>>>           return response
>>>>>
>>>>>
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "Django users" group.
>>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>>> an email to django-users...@googlegroups.com.
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/django-users/42a1e5d3-718b-4a09-8dbd-b035756765c9n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/django-users/42a1e5d3-718b-4a09-8dbd-b035756765c9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Django users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to django-users...@googlegroups.com.
>>>> To view this discussion on the web visit
>>>> https://groups.google.com/d/msgid/django-users/CACaE8x6rJ6ie3dAZPaJYcaJLn7P1Mu%3D7Q%2B6eWxvo%3D6KuSCAxEw%40mail.gmail.com
>>>> <https://groups.google.com/d/msgid/django-users/CACaE8x6rJ6ie3dAZPaJYcaJLn7P1Mu%3D7Q%2B6eWxvo%3D6KuSCAxEw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-users...@googlegroups.com.
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CACM0XWxFOpkjaLF75ROU3bqgYP6B3B4WxNc%2BK_RAe-uN0zNCJw%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CACM0XWxFOpkjaLF75ROU3bqgYP6B3B4WxNc%2BK_RAe-uN0zNCJw%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4031a33d-840b-42b9-913b-c721caa3a8can%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/4031a33d-840b-42b9-913b-c721caa3a8can%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAJNnRhv25bAzr%3DfzxJTmZ%2By-gxUSZf4%2BP%2BEeQNyoNwSR%3Dwd7OQ%40mail.gmail.com.

Reply via email to