![]() ![]() Header, Body, and Footer of PDF document generated in Python (Image by the author) How to Add Text to a PDF File You can find the respective code by the cell name. To create space between cells, you can use the set_xy() method to specify a specific position for the next element or the ln() method to create vertical space.īelow you can see a few examples of cells and their layouts. The ln parameter defines where the position should go after this cell: A w = 0 will result in a text cell that spans across the entire page width. With the w and h parameters, you can define the width and height of the text cell. When you achieve your desired design, you can set the parameter value back to 0. To showcase the resulting layout, we will set the parameter border = 1, which shows the cell’s border. You can add text cells with the cell() method. Next, let’s understand the layout of the document. ![]() You can define custom page configurations with the parameters of the add_page() method. The default page is an A4 format in portrait mode with 1cm margins. ![]() Empty PDF document created with three lines of code in FPDF in Python (Image by the author)
0 Comments
Leave a Reply. |