[Python] Reportlab. Floating Text with two Columns

Discussão em 'Python' iniciado por Stack, Março 6, 2025.

  1. Stack

    Stack Membro Participativo

    First of all, I'm new to python, reportlab, xhtml2pdf. I've already done my first pdf files with reportlab, but I ran into the following problem.

    I need a large text in two columns.

    First I create my canvas, create my story, append my large text as a paragraph to the story, create my Frame and finally add the story to the frame.

    c = Canvas("local.pdf")
    storyExample = []
    textExample = (""" This is a very large text Lorem Ipsum ... """)
    storyExample.append(Paragraph(textExample, styleText))
    frameExample = Frame(0, 0, 50, 50,showBoundary=0)
    frameExample.addFromList(storyExample,c)
    c.showPage()
    c.save()


    Works like a charm. But I need to show the text in a two column represantation.

    Now the text just flows threw my frame like:

    |aaaaaaaaaaaaaaaaaaaa|
    |bbbbbbbbbbbbbbbbbbbb|
    |cccccccccccccccccccc|
    |dddddddddddddddddddd|


    But I need it like this:

    |aaaaaaaaa bbbbbbbbbb|
    |aaaaaaaaa cccccccccc|
    |bbbbbbbbb cccccccccc|
    |bbbbbbbbb dddddddddd|


    I hope you understood what I am trying to say.

    Continue reading...

Compartilhe esta Página