在 Ruby 中将 PDF 转换为 SVG 格式

Aspose.PDF - 将 PDF 转换为 SVG

要使用 Aspose.PDF Java for Ruby 将 PDF 转换为 SVG 格式,只需调用 PdfToSvg 模块。

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')

# instantiate an object of SvgSaveOptions

save_options = Rjb::import('com.aspose.pdf.SvgSaveOptions').new

# do not compress SVG image to Zip archive

save_options.CompressOutputToZipArchive = false

# Save the output to XLS format

pdf.save(data_dir + "Output.svg", save_options)

puts "Document has been converted successfully"

下载运行代码

下载В **Convert PDF to SVG Format (Aspose.PDF)**В 来自以下提到的社交编程站点: