Mengonversi HTML ke Format PDF di Ruby
Contents
[
Hide
]
Aspose.PDF - konversi HTML ke Format PDF
Untuk mengkonversi HTML ke format PDF menggunakan Aspose.PDF Java for Ruby, cukup panggil modul HtmlToPdf.
Kode Ruby
# The path to the documents directory.
data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
htmloptions = Rjb::import('com.aspose.pdf.HtmlLoadOptions').new(data_dir)
# Load HTML file
pdf = Rjb::import('com.aspose.pdf.Document').new(data_dir + "index.html", htmloptions)
# Save the concatenated output file (the target document)
pdf.save(data_dir + "html.pdf")
puts "Document has been converted successfully"
Mengunduh kode yang dapat dijalankan
Unduh Convert HTML to PDF Format (Aspose.PDF) dari salah satu situs coding sosial yang disebutkan di bawah ini: