Module: Asposeslidesjava::CreatingSvg

Defined in:
lib/asposeslidesjava/Slides/creatingsvg.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
20
21
22
23
24
25
# File 'lib/asposeslidesjava/Slides/creatingsvg.rb', line 3

def initialize()
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
            
    # Instantiate Presentation class that represents the presentation file
    pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'demo.pptx')

    # Getting last slide index
    last_slide_position = pres.getSlides().size()
    
    #Iterating through every presentation slide and generating SVG image
    i = 0
    while i < last_slide_position
        # Accessing Slides
        slide = pres.getSlides().get_Item(i)

        # Getting and saving the slide SVG image    
        slide.writeAsSvg(Rjb::import('java.io.FileOutputStream').new(data_dir + "SvgImage#{i}.svg"))
            
        i +=1    
    end

    puts "Created SVG images, please check output files."
end