Summary
Share a clear and concise description of the issue. Aim for 2-3 sentences.
Steps to reproduce
Code snippet:
add code here
If applicable, please provide the steps we should take to reproduce the error or specified behavior.
Expected behavior:
Explain what you expect to happen when you run the code above.
Actual behavior:
Explain the undesired behavior or error you see when you run the code above.
If you’re seeing an error message, share the full contents of the error message here.
Debug info
- Streamlit version: (get it with
$ streamlit version
) - Python version: (get it with
$ python --version
) - Using Conda? PipEnv? PyEnv? Pex?
- OS version:
- Browser version:
Requirements file
Using Conda? PipEnv? PyEnv? Pex? Share the contents of your requirements file here.
Not sure what a requirements file is? Check out this doc and add a requirements file to your app.
Links
- Link to your GitHub repo:
- Link to your deployed app:
Additional information
If needed, add any other context about the problem here.
df = data.to_dict(orient=“records”)
def convert_csv_to_pdf(df):
pdf = FPDF()
pdf.add_page()
pdf.set_font(“Arial”, size = 12)
# Add data to PDF
for row in df:
pdf.cell(200, 10, f"Organ: {row['organ.']}", ln=True)
pdf.cell(200, 10, f"Month: {row['month']}", ln=True)
pdf.cell(200, 10, f"Room Category: {row['Room Category']}", ln=True)
pdf.cell(200, 10, f"RM Nights: {row['RM Nights']}", ln=True)
pdf.cell(200, 10, f"Revenue: {row['Revenue']:.2f}", ln=True)
pdf.cell(200, 10, f"ARR: {row['ARR']:.2f}", ln=True)
pdf.ln()
Convert CSV data to PDF
if st.button(“Generate PDF”):
convert_csv_to_pdf(df)
st.success("PDF generated successfully!")
st.download_button(label=“Download PDF”, data=“data.pdf”, file_name=“data.pdf”)
this code and its download pdf but not show data showing something went wrong how to resolve this.