0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PDFのページを結合,すぐコピペシリーズ

Posted at

PDFファイルの結合

PDFの結合をたまに使うので、すぐに使える状態で自分用に。
PyPDF2のpipインストールが必要。
以上。

merge_pdf.py
import PyPDF2

# 別々のpdfファイルを結合します
def merge_pdf(pdf_files):
    merger = PyPDF2.PdfFileMerger()
    for pdf in pdf_files:
        merger.append(pdf)

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

if __name__ == "__main__":
    pdf_files = ["a.pdf","b.pdf"]
    merge_pdf(pdf_files)    
0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?