Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende PdfWriter | Manipulating and Combining PDFs
Manipulating and Combining PDFs

book
PdfWriter

PdfWriter is a class in PyPDF2 library that provides a way to create or manipulate PDF files. It allows developers to add, remove or modify the contents of a PDF document. PdfWriter is useful for automating the creation of PDF files, merging multiple PDF files, and modifying existing PDF documents in Python.

Tarea

Swipe to start coding

  1. Create a merger object as instance PdfWriter();
  2. Merge two PDFs together using the .append() method of PdfWriter;
  3. Write merged PDFs to a file called merged_pdf.

Solución

from PyPDF2 import PdfWriter

merger = PdfWriter()

for pdf in ["example.pdf", "example.pdf"]:
merger.append(pdf)

merger.write("merged_pdf.pdf")
merger.close()

Mark tasks as Completed
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 1. Capítulo 4
AVAILABLE TO ULTIMATE ONLY
some-alt