プログラムで写真を PDF に変換する必要がありますか?この Java ライブラリを使用すると、ソフトウェア開発者は数行のコードで写真をPortable Document Formatに簡単に変換できます。
Java 用の最新の画像処理APIは、プロ品質の写真から PDF ファイルを作成します。最高品質の写真から PDF への変換をブラウザで直接テストできます。強力な Java ライブラリを使用すると、写真を多くの一般的なファイル形式に変換できます。
次の例は、Java で写真を PDF 形式に変換する方法を示しています。
簡単な手順に従って、写真を PDF ドキュメント形式に変換します。ローカルドライブから写真を読み取り、PDF ファイル名拡張子を指定して PDF 形式にエクスポートするだけです。
// Repository path: https://releases.aspose.com/java/repo/
// Maven, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-words</artifactId>
<version>ver</version>
<classifier>jdk17</classifier>
</dependency>
コピー
// Repository path: https://releases.aspose.com/java/repo/
// Gradle, where 'ver' - Aspose.Words version number, for example, 24.4.
compile(group: 'com.aspose', name: 'aspose-words', version: 'ver', classifier: 'jdk17')
コピー
// Repository path: https://releases.aspose.com/java/repo/
// Ivy, where 'ver' - Aspose.Words version number, for example, 24.4.
<dependency org="com.aspose" name="aspose-words" rev="ver">
<artifact name="aspose-words" m:classifier="jdk17" ext="jar"/>
</dependency>
コピー
// Repository path: https://releases.aspose.com/java/repo/
// Sbt, where 'ver' - Aspose.Words version number, for example, 24.4.
libraryDependencies += "com.aspose" % "aspose-words" % "ver"
コピー
import com.aspose.words.*;
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertImage("Input.jpg");
doc.save("Output.pdf");
import com.aspose.words.*;
Document doc = new Document("Input.jpg");
doc.save("Output.pdf");
import com.aspose.words.*;
Document doc = new Document("Input.jpg");
ImageSaveOptions saveOptions = new ImageSaveOptions(SaveFormat.pdf);
for (int page = 0; page < doc.getPageCount(); page++)
{
saveOptions.setPageSet(new PageSet(page));
doc.save(String.format("Output_%d.pdf", page + 1), saveOptions);
}
import com.aspose.words.*;
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertImage("Input.jpg");
doc.save("Output.pdf");
import com.aspose.words.*;
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.insertImage("Input.jpg");
shape.getShapeRenderer().save("Output.pdf", new ImageSaveOptions(SaveFormat.pdf));
Java パッケージはMavenリポジトリでホストします。 'Aspose.Words for Java' は、バイトコードを含む一般的な JAR Java開発者環境にインストールする方法のステップバイステップの説明に従ってください。
Java SE 7 Java バージョンがサポートされています。 JRE を使用する必要がある場合に備えて Java SE 6 用の個別のパッケージも提供しています。
私たちの Java Microsoft Windows 、Linux、macOS、Android、iOS JVM 実装されているすべてのオペレーティングシステムで実行されます。
JogAmp JOGL 、 Harfbuzz フォントエンジン、 Java Advanced Imaging JAI などのオプションのパッケージ依存関係については、製品ドキュメントを参照してください。