Module: Asposepdfjava::HelloWorld

Defined in:
lib/asposepdfjava/helloworld.rb

Instance Method Summary collapse

Instance Method Details

#initializeObject



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

def initialize()
    data_dir = File.dirname(File.dirname(File.dirname(__FILE__))) + '/data/'
            
    # Create PDF document
    pdf = Rjb::import('aspose.pdf.Pdf').new
    
    # Add a section into the PDF document
    section = pdf.getSections().add()
    
    # Add a text paragraph into the section
    section.getParagraphs().add(Rjb::import('aspose.pdf.Text').new("Hello World"))

    # Save the document
    pdf.save(data_dir + "HelloWorld.pdf")

    puts "Document has been saved, please check the output file."
end