Skip to main content

指定したファイルサイズを上限としてPDFを複数のファイルに分割するコマンドラインツール

Project description

PDF Size Splitter

License: MIT Python 3.8+

指定したファイルサイズ(バイト)を上限として、PDFを複数のファイルに分割するコマンドラインツールです。
ページ構造を破壊せず、指定サイズに収まる最大のページ数ごとに自動で分割します。


特徴(Features)

精密なファイルサイズ分割

PDFの構造を考慮しながら、指定したサイズに近づくようにページ単位で分割します。
オンラインツールでは不安定になりがちな「サイズ基準の分割」を、ローカルで再現性高く実行できます。

ローカル完結で安全

アップロード不要で、すべてローカル環境で処理されます。
機密情報を含むPDFでも安全に扱えるため、業務用途にも適しています。

制限なし・高速処理

オンラインサービスにありがちな

  • ファイルサイズ上限
  • タスク数制限
  • 待ち時間

といった制約がありません。大量ファイルのバッチ処理にも向いています。

透明性のある処理ロジック

分割アルゴリズムはコードとして公開されており、挙動がブラックボックスになりません。
必要に応じてロジックを改良したり、ワークフローに合わせて拡張できます。

ワークフローへの統合が容易

Pythonスクリプトとして動作するため、

  • 自動処理パイプライン
  • 他ツールとの連携
  • GUI化やAPI化

など、用途に応じた柔軟な統合が可能です。

再現性の高い結果

同じ入力に対して常に同じ出力が得られるため、
業務フローや自動化処理で重要な「結果の安定性」を確保できます。


機能

  • 指定したサイズ(バイト)でPDFを自動分割
  • ページ構造を保持
  • 効率的な分割アルゴリズム(平均ページサイズからの予測 + 微調整)
  • コマンドラインインターフェース

必須環境

  • Python 3.8以上
  • 依存ライブラリ: pypdf

インストール方法

PyPIからインストール(推奨)

pip install pdf-size-splitter

ソースからインストール

  1. リポジトリをクローンまたはダウンロードします。
  2. 以下のコマンドで依存ライブラリをインストールします。
pip install -r requirements.txt

使い方

以下のコマンド形式で実行します。

python pdf_size_splitter.py <入力PDFのパス> <上限サイズ(バイト)> [-o 出力先ディレクトリ]

実行例

# sample.pdf を 10MB (10000000バイト) 単位で分割し、現在のディレクトリに保存する
python pdf_size_splitter.py sample.pdf 10000000

# sample.pdf を 5MB 単位で分割し、"output" フォルダに保存する
python pdf_size_splitter.py sample.pdf 5000000 -o output

ライセンス

このプロジェクトはMIT Licenseの下で公開されています。詳細は LICENSE ファイルを参照してください。

作者

momoandbanana22

貢献

貢献を歓迎します!バグ報告や機能リクエストは Issues にてお願いします。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf_size_splitter-0.1.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf_size_splitter-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file pdf_size_splitter-0.1.0.tar.gz.

File metadata

  • Download URL: pdf_size_splitter-0.1.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pdf_size_splitter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6118aefd9132f1619de2ed1191bc82a637f58f2697365fab049b61eefc7e6ee7
MD5 d6ff80c91e6c4c60034b4334bf930310
BLAKE2b-256 d7dbd1e4529741a47e7a4c1853d3d2b369780ac9e2e062331f42b93cc29d1276

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdf_size_splitter-0.1.0.tar.gz:

Publisher: publish-to-pypi.yml on momoandbanana22/pdf-size-splitter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pdf_size_splitter-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pdf_size_splitter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c303f8015e1e54fc188df1ac9cc43f29769817438691bd63d8a2e11fd409516
MD5 4a04306eb03a4f05224ace1397f9f02f
BLAKE2b-256 91b38d5c2f77e0567db3efbb8c6602bcede2b74a873b4143d7d2d6974d01eff2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pdf_size_splitter-0.1.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on momoandbanana22/pdf-size-splitter

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page