You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using default_css in the CreatePDF(), the generative pdf will blank. PDF not taking any html content.
result = pisa_status = pisa.CreatePDF(html, dest=f, default_css=default_css) also font-family not working when using CreatePDF() . I have tried many ways and update version also.
I have used inline, external css also. Please suggest here.
OS version:
Python version: 3.11.4
XHTML2PDF version: 0.2.13
The text was updated successfully, but these errors were encountered:
@Denny814 Thanks for the report!
Unfortunately, I'm not able to reproduce this problem. Could you please provide a minimal example of the HTML & CSS code you're trying to render?
And which font family are you using?
I am using xhtml2pdf(0.2.13) to generate PDF. When i used 'default_css' to render css in the html file, Blank PDF generate . CSS and the HTML content not rendered in the generated PDF file.
Below is my python code
with open(output_filename, 'wb') as output_file:
result = pisa.CreatePDF(
src=html_content,
dest=output_file,
default_css=default_css
)
Below is my default_css html code
Default CSS definition
default_css = """
body {
font-family: Arial, sans-serif;
font-size: 12pt;
}
h1 {
color: #007bff;
}
/* Add more styles as needed */
"""
Below is my html_content html code
Example HTML content
html_content = """
<title>Sample PDF with Default CSS</title>
Hello, World!
This is a sample PDF with default CSS.
"""
Please let me know if anything you needed.
Thanks.
When using default_css in the CreatePDF(), the generative pdf will blank. PDF not taking any html content.
result = pisa_status = pisa.CreatePDF(html, dest=f, default_css=default_css) also font-family not working when using CreatePDF() . I have tried many ways and update version also.
I have used inline, external css also. Please suggest here.
OS version:
Python version: 3.11.4
XHTML2PDF version: 0.2.13
The text was updated successfully, but these errors were encountered: