I would need a solution to combine PDF files. I needed some possibility to add text to the PDF template. I have been working so far by creating a PDF file with text using FPDF and merging it using PdfFileMerger. But it happens to me that he creates a new PDF file from both pages, and I should only have the text from the PDF that I generated using FPDF be generated on the PDF template.
This solution doesn't work for me because it tells me that there is no PyPDF2.pdf even though PyPDF2.pdf is properly installed: Merge two pages into pdf into one page pdf
Here is what I do with FPDF:
#work in jupyter
from fpdf import FPDF
from pathlib import Path
from PyPDF2 import PdfFileMerger
profile = FPDF()
profile.add_page()
profile.set_font('Arial', 'B', 16)
profile.cell(500, 200, 'Edi Graovac!')
profile.output("temp.pdf", 'F')
merger = PdfFileMerger(strict=False)
profile_pdf=open("temp.pdf", 'rb')
template=open(template_path, 'rb')
merger.append(template)
merger.merge(0,profile_pdf)
merger.write(save_path)
merger.close()