Tag: Python PDF

情報

ライブラリ

比較

画像挿入

ReportLab

PyMuPDF

トラブル

  1. 問題:画像の配置位置がずれる。(2021/02/08)
    • 原因:PDF内の座標系が異なって設定されているため。
    • 参考:
      • python 3.x - PyMuPDF insert image at bottom - Stack Overflow
        Some pages internally change the standard PDF geometry (which uses the bottom-left page point as (0, 0)) to something else, and at the same time do not encapsulate this doing properly as they should.
      • Collection of Recipes — PyMuPDF 1.18.8 documentation
        The creator of the PDF has established a non-standard page geometry without keeping it “local” (as they should!). Most commonly, the PDF standard point (0,0) at bottom-left has been changed to the top-left point. So top and bottom are reversed – causing your insertion to be misplaced.
    • 対策:Page.cleanContents()を呼べば良い。但し、他のプロパティも削除されるので注意。

関連


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS