Skip to main content

Add Chart to you PDF Report

Okay, we discover how to add static content, what about dynamic content? Lets find out

As I previously mention you have python/* folder with your .ipynb scripts, lets create a simple python script python/example.ipynb

And lets output some content

nav = 1000000

report_currency = 'USD'

result = f"<h1>NAV: {nav} {report_currency}</h1>"

print(result)

Screenshot 2024-08-15 at 18.13.38.png

Well done, lets go back to our PDF Builder

Screenshot 2024-08-15 at 18.08.07.png

Scroll down and find Block - Python HTML Block, drop it on canvas

Screenshot 2024-08-15 at 18.08.41.png

Then click on it, and let see the Block Settings (On right sidebar, cog button)

Screenshot 2024-08-15 at 18.09.34.png

So we have here 3 inputs

Absolute File Path - full path from root (/) of your Space Storage
Relative File Path - path from your builder location, so you can do like .python/example.ipynb
Data (JSON) - json field that could have some predefined settings for you .ipynb script

NOTA BENE: Relative File Path when set, it overrides Absolute File Path, so if you dont need relative path, just set it to null and use absolute path, otherwise, dont use Absolute File Path, when you type Relative File Path it will automatically calculated and passed to Absolute File Path

Lets put ./python/example.ipynb and see what will happen

Screenshot 2024-08-15 at 18.14.00.png


Great, now the result of your python/example.ipynb is executed and added to your PDF Template, well Done