Module: Asposepdfjava::HtmlToPdf

Defined in:
lib/asposepdfjava/Converter/htmltopdf.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/asposepdfjava/Converter/htmltopdf.rb', line 3

def initialize()
	# 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"
end