Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create more than one page #1314

Closed
rose-ramasamy opened this issue Mar 17, 2021 · 3 comments
Closed

Unable to create more than one page #1314

rose-ramasamy opened this issue Mar 17, 2021 · 3 comments

Comments

@rose-ramasamy
Copy link

rose-ramasamy commented Mar 17, 2021

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:

import pandas
from pdf_reports import pug_to_html, write_report
from pdf_reports import ReportWriter

litems = ["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 list
Row_list = []

# Iterate over each row
for index, rows in df.iterrows():
    # Create list for the current row
    my_list = [rows.Date, rows.Event, rows.Cost]

    # append the list to the final list
    Row_list.append(my_list)

# Print the list
print(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
@grewn0uille
Copy link
Member

Hello!
I think you should open an issue on pdf_reports repository as it is what you use.

@rose-ramasamy
Copy link
Author

Thanks

@liZe
Copy link
Member

liZe commented Apr 21, 2021

For the record: Edinburgh-Genome-Foundry/pdf_reports#15.

The problem you have in this comment is a duplicate of #1292.

Feel free to reopen if we can help you!

@liZe liZe closed this as completed Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants