プログラムで写真を PDF に変換する必要がありますか?この Python ライブラリを使用すると、ソフトウェア開発者は数行のコードで写真をPortable Document Formatに簡単に変換できます。
Python 用の最新の画像処理APIは、プロ品質の写真から PDF ファイルを作成します。最高品質の写真から PDF への変換をブラウザで直接テストできます。強力な Python ライブラリを使用すると、写真を多くの一般的なファイル形式に変換できます。
次の例は、Python で写真を PDF 形式に変換する方法を示しています。
簡単な手順に従って、写真を PDF ドキュメント形式に変換します。ローカルドライブから写真を読み取り、PDF ファイル名拡張子を指定して PDF 形式にエクスポートするだけです。
pip install aspose-words
コピー
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.insert_image("Input.jpg")
doc.save("Output.pdf")
import aspose.words as aw
doc = aw.Document("Input.jpg")
doc.save("Output.pdf")
import aspose.words as aw
doc = aw.Document("Input.jpg")
save_options = aw.saving.ImageSaveOptions(aw.SaveFormat.pdf)
for page in range(doc.page_count):
save_options.page_set = aw.saving.PageSet(page)
doc.save(f"Output_{page + 1}.pdf", save_options)
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
builder.insert_image("Input.jpg")
doc.save("Output.pdf")
import aspose.words as aw
doc = aw.Document()
builder = aw.DocumentBuilder(doc)
shape = builder.insert_image("Input.jpg")
shape.get_shape_renderer().save("Output.pdf", aw.saving.ImageSaveOptions(aw.SaveFormat.pdf))
Python パッケージはPyPiリポジトリでホストしています。 "Aspose.Words for Python via .NET" 開発者環境にインストールする方法のステップバイステップの説明に従ってください。
このパッケージは Python ≥3.5 および <3.12 と互換性があります。 Linux 用のソフトウェアを開発する場合は、 製品ドキュメントの gcc および libpython の追加要件を参照してください。