Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created March 28, 2018 16:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/700648f5a33df6017c821632a1d82ce5 to your computer and use it in GitHub Desktop.
Save parzibyte/700648f5a33df6017c821632a1d82ce5 to your computer and use it in GitHub Desktop.
from PyPDF2 import PdfFileMerger
import os
pdfs = [archivo for archivo in os.listdir('./') if archivo.endswith(".pdf")]
nombre_archivo_salida = "salida.pdf"
fusionador = PdfFileMerger()
for pdf in pdfs:
fusionador.append(open(pdf, 'rb'))
with open(nombre_archivo_salida, 'wb') as salida:
fusionador.write(salida)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment