'fpdf/pyfpdf -- Append a static single pdf file after generating each new pdf

I have been using the fpdf package to create bulk size dynamic pdf files. Each pdf file has one page. Now I have another pdf file that I want to append after generating each pdf. So basically, each pdf file will contain 2 pages where the first page is dynamic and the second pdf file is static.

But I can't append the static pdf file after creating the dynamic pdf file.

The following code will generate the first page. Now how will I append my already existing second pdf file?

for i in range(0,df1.shape[0]):
  id_num = df1["pid"][i]
  name = df1["respondent_name"][I]
  pdf = FPDF(orientation='L', unit='mm', format='A5') 
  pdf.add_page()

  pdf_init()
  .....
  some functions()
  .....

  pdf.output('output\\test\\T1_202204_' + str(id_num) + '.pdf','F')


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source