I’m trying to reduce the margins of a page using borb
, that works, but my Table
then is not taking the full width of the page.
What’s the fix for that ?
from decimal import Decimal
from borb.pdf import Document, Page, SingleColumnLayout, PageLayout, Paragraph, Image, PDF
def main():
# Create document
pdf = Document()
# Add page
page = Page()
pdf.add_page(page)
# create PageLayout
page_layout: PageLayout = SingleColumnLayout(page)
for i in [Decimal(0), Decimal(16), Decimal(32), Decimal(64)]:
page_layout._margin_left = i
page_layout._margin_right = i
page_layout._margin_bottom = i
page_layout._margin_top = i
# Add Paragraph
page_layout.add(Paragraph(f"padding set at {int(i)}"))
page_layout.add(
FixedColumnWidthTable(
number_of_columns=3, number_of_rows=3
)
)
with open("output.pdf", "wb") as out_file_handle:
PDF.dumps(out_file_handle, pdf)
if __name__ == "__main__":
main()
Thanks for your help !