Module: Asposeslidesjava::ConvertingToTiff

Defined in:
lib/asposeslidesjava/Presentation/convertingtotiff.rb

Instance Method Summary collapse

Instance Method Details

#convert_with_custom_sizeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/asposeslidesjava/Presentation/convertingtotiff.rb', line 24

def convert_with_custom_size()
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
            
    # Instantiate a Presentation object that represents a PPTX file
    pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")

    # Instantiate the TiffOptions class
    opts = Rjb::import('com.aspose.slides.TiffOptions').new

    # Setting compression type
    tiff_compression_types = Rjb::import('com.aspose.slides.TiffCompressionTypes')
    opts.setCompressionType (tiff_compression_types.Default)

    # Compression Types
    #Default - Specifies the default compression scheme (LZW).
    #None - Specifies no compression.
    #CCITT3
    #CCITT4
    #LZW
    #RLE

    # Depth – depends on the compression type and cannot be set manually.
    # Resolution unit – is always equal to “2” (dots per inch)

    #Setting image DPI
    opts.setDpiX(200)
    opts.setDpiY(100)

    # Set Image Size
    opts.setImageSize(Rjb::import('java.awt.Dimension').new(1728, 1078))

    # Save the presentation to TIFF with specified image size
    save_format = Rjb::import('com.aspose.slides.SaveFormat')
    pres.save(data_dir + "Aspose-Custom-Size.tiff", save_format.Tiff, opts)

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

#convert_with_default_sizeObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/asposeslidesjava/Presentation/convertingtotiff.rb', line 11

def convert_with_default_size()
    data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'
            
    # Instantiate a Presentation object that represents a PPTX file
    pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + "Aspose.pptx")

    # Saving the PPTX presentation to Tiff format
    save_format = Rjb::import('com.aspose.slides.SaveFormat')
    pres.save(data_dir + "Aspose.tiff", save_format.Tiff)

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

#initializeObject



3
4
5
6
7
8
9
# File 'lib/asposeslidesjava/Presentation/convertingtotiff.rb', line 3

def initialize()
    # Converting Presentation to TIFF with default size
    convert_with_default_size()

    # Converting Presentation to TIFF with custom size
    convert_with_custom_size()
end