在 Ruby 中向 PDF 文件末尾插入空白页

Aspose.PDF - 在 PDF 文件末尾插入空白页

要使用 Aspose.PDF Java for Ruby 在 PDF 文档末尾插入空白页,只需调用 InsertEmptyPageAtEndOfFile 模块。

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().add()

# Save the concatenated output file (the target document)

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

puts "Empty page added successfully!"

下载运行代码

下载 **在 PDF 文件末尾插入空页 (Aspose.PDF)**В 来自以下提到的任何社交编码站点: