Mengonversi file SVG ke format PDF dalam Ruby

Aspose.PDF - konversi SVG ke PDF

Untuk mengonversi file SVG ke format PDF menggunakan Aspose.PDF Java for Ruby, cukup panggil modul SvgToPdf.

Kode Ruby

# The path to the documents directory.

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

# Instantiate LoadOption object using SVG load option

options = Rjb::import('com.aspose.pdf.SvgLoadOptions').new

# Create document object

pdf = Rjb::import('com.aspose.pdf.Document').new(data_dir + 'Example.svg', options)

# Save the output to XLS format

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

puts "Document has been converted successfully"

Mengunduh kode yang dapat dijalankan

Unduh Convert SVG to PDF (Aspose.PDF) dari salah satu situs coding sosial yang disebutkan di bawah: