Ruby での PDF ファイルへの空白ページの挿入

Aspose.PDF - 空白ページの挿入

Aspose.PDF Java for Ruby を使用して PDF ドキュメントに空白ページを挿入するには、単に InsertEmptyPage モジュールを呼び出してください。

Ruby コード

# The path to the documents directory.

data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'

# Open the target document

pdf = Rjb::import('com.aspose.pdf.Document').new(data_dir + 'input1.pdf')

# insert a empty page in a PDF

pdf.getPages().insert(1)

# Save the concatenated output file (the target document)

pdf.save(data_dir+ "output.pdf")

puts "Empty page added successfully!"

実行コードのダウンロード

以下に記載されたソーシャルコーディングサイトから Insert an Empty Page (Aspose.PDF) をダウンロードしてください。