Python Forum
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ReportLab
#1
I have 7 pages pdf file and I am trying to write on existing pdf file . I can write on the first page however I cannot write on the rest of pages  

self.canvas.save() 
            output = PdfFileWriter()
            self.packet.seek(0)

            new_pdf = PdfFileReader(self.packet)
          
            existing_pdf = PdfFileReader(open(filename,"rb"))
            for i in range(0,existing_pdf.getNumPages()):
                page = existing_pdf.getPage(0)
                page.mergePage(new_pdf.getPage(0))
                output.addPage(page)
            outputStream = open('/home/egor/destination.pdf',"wb")
            output.write(outputStream)
            outputStream.close()
Reply
#2
Have you seen this page: https://www.programcreek.com/python/exam...FileWriter
Reply
#3
I could not find any relevant examples from there
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Reportlab - change a single page orientation beetlecad 1 1,566 Aug-16-2024, 05:43 PM
Last Post: beetlecad
  Highlight text with Reportlab beetlecad 2 2,069 Aug-07-2024, 09:36 AM
Last Post: Pedroski55
  [SOLVED] Looking for documentation on Reportlab's canvas.transform() function NeilUK 1 1,505 Aug-23-2023, 01:21 PM
Last Post: NeilUK
  Right to left alignment in python report using Reportlab jalal0034 1 3,809 Sep-27-2022, 04:25 AM
Last Post: jalal0034
  Label Maker FPDF, Reportlab jamesaarr 1 4,292 Aug-09-2021, 11:57 PM
Last Post: Pedroski55
  cyrillic symbols in tables in reportlab. hiroz 5 15,549 Sep-10-2020, 04:57 AM
Last Post: bradmalcom
  Using Reportlab to create a landscape pdf SmukasPlays 2 8,666 Aug-09-2020, 09:31 PM
Last Post: SmukasPlays
  Help! - How to create a Title for a Reportlab Table crabbylou 0 6,598 Mar-29-2020, 09:14 PM
Last Post: crabbylou
  ReportLab Polypop77 0 2,411 Mar-20-2020, 01:17 PM
Last Post: Polypop77
  Python Reportlab Wordwrap Table Mady 0 9,510 Dec-18-2018, 06:31 AM
Last Post: Mady

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020