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
I am trying to create PDF reports using python. I have the content for more than one page but if I generate a report it is failing to create.
Note: If I reduce the content the pdf is created with a single page.
Please help me.. Thanks in advance.
My python file look like this:
importpandasfrompdf_reportsimportpug_to_html, write_reportfrompdf_reportsimportReportWriterlitems= ["apple", "banana", "cherry","apple", "banana", "cherry","apple", "banana", "cherry","apple", "banana", "cherry","apple", "banana", "cherry","apple", "banana", "cherry"]
dataframe=pandas.DataFrame.from_records({
"Name": ["US", "Netherlands", "Germany"],
"Status": ['Pass','Pass','Fail']
}, columns=["Name", "Status"])
print(dataframe)
df=pandas.DataFrame({'Date':['10/2/2011', '11/2/2011', '12/2/2011', '13/2/11'],
'Event':['Music', 'Poetry', 'Theatre', 'Comedy'],
'Cost':[10000, 5000, 15000, 2000]})
# Create an empty listRow_list= []
# Iterate over each rowforindex, rowsindf.iterrows():
# Create list for the current rowmy_list= [rows.Date, rows.Event, rows.Cost]
# append the list to the final listRow_list.append(my_list)
# Print the listprint(Row_list)
report_writer=ReportWriter(
default_stylesheets=["style.css"],
default_template="example_template.pug"
)
html=report_writer.pug_to_html(title="My report",items=litems,data=Row_list)
report_writer.write_report(html, "example.pdf")
my template file look like this:
#sidebar: p Hey, I am a sidebar text ! I make your document look much more serious.
h1 {{ title }}
:markdown
You can install `pdf_reports` with Python's PIP:
.ui.container
.ui.icon.message.yellow.block-center
i.exclamation.circle.icon
.content .header This is an important message, as per the exclamation mark.
:markdown ## I am a section title
{% for c in items %}
p {{c}}
{% endfor %}
{% for value in data %}
p {{ value }}
{% endfor %}
table.ui.celled.table
thead
tr
th File
th description
tbody
tr
td No Name Specified
td Unknown
td.negative None
The text was updated successfully, but these errors were encountered:
Hi there,
I am trying to create PDF reports using python. I have the content for more than one page but if I generate a report it is failing to create.
Note: If I reduce the content the pdf is created with a single page.
Please help me.. Thanks in advance.
My python file look like this:
my template file look like this:
The text was updated successfully, but these errors were encountered: