question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to create more than one page

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rose-ramasamycommented, Mar 23, 2021

It worked @veghp. Thanks for support.

0reactions
rose-ramasamycommented, Apr 21, 2021

Hi there… This solved the issue in windows. But in Linux experiencing different issues. When I run the same program in Linux getting the following error: image

Can someone help on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot problems creating a Facebook Page
Learn about reasons you may have trouble creating a Page on Facebook.
Read more >
Problem creating new pages | WordPress.org
when trying to create a new page or post I get this weird message then can't edit or publish the page. The site...
Read more >
How to Create More Than One Facebook Page With the Same ...
How to Create More Than One Facebook Page With the Same Email Address : Facebook Tricks & Techniques. 66K views 10 years ago....
Read more >
Common printing issues - Microsoft Support
Under Settings, click One page per sheet, and then choose Multiple pages per sheet in the list. Click Print. Tip: Print a test...
Read more >
Solved: Can't create new pages - Atlassian Community
Unfortunately I am not able to create new pages since then (infinite loading). There are no errors in the page itself, nor in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found