Module: Asposeslidesjava::Frame
- Defined in:
- lib/asposeslidesjava/Shapes/frame.rb
Instance Method Summary collapse
- #add_audio_frame ⇒ Object
- #add_picture_frame ⇒ Object
- #add_video_frame ⇒ Object
- #initialize ⇒ Object
Instance Method Details
#add_audio_frame ⇒ Object
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/Shapes/frame.rb', line 36 def add_audio_frame() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/' # Create an instance of Presentation class pres = Rjb::import('com.aspose.slides.Presentation').new # Get the first slide sld = pres.getSlides().get_Item(0) # Load the wav sound file to stram fstr = Rjb::import('java.io.FileInputStream').new(Rjb::import('java.io.File').new(data_dir + "Bass-Drum.wav")) # Add Audio Frame af = sld.getShapes().addAudioFrameEmbedded(50, 150, 100, 100, fstr) # Set Play Mode and Volume of the Audio af.setPlayMode(Rjb::import('com.aspose.slides.AudioPlayModePreset').Auto) af.setVolume(Rjb::import('com.aspose.slides.AudioVolumeMode').Loud) # Write the presentation as a PPTX file save_format = Rjb::import('com.aspose.slides.SaveFormat') pres.save(data_dir + "AudioFrameEmbed.pptx", save_format.Pptx) puts "Added audio frame to slide, please check the output file." end |
#add_picture_frame ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/asposeslidesjava/Shapes/frame.rb', line 14 def add_picture_frame() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/' # Create an instance of Presentation class pres = Rjb::import('com.aspose.slides.Presentation').new # Get the first slide sld = pres.getSlides().get_Item(0) # Instantiate the Image class imgx = pres.getImages().addImage(Rjb::import('java.io.FileInputStream').new(Rjb::import('java.io.File').new(data_dir + "aspose-logo.jpg"))) # Add Picture Frame with height and width equivalent of Picture sld.getShapes().addPictureFrame(Rjb::import('com.aspose.slides.ShapeType').Rectangle, 50, 150, imgx.getWidth(), imgx.getHeight(), imgx) # Write the presentation as a PPTX file save_format = Rjb::import('com.aspose.slides.SaveFormat') pres.save(data_dir + "RectPicFrame.pptx", save_format.Pptx) puts "Added picture frame to slide, please check the output file." end |
#add_video_frame ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/asposeslidesjava/Shapes/frame.rb', line 62 def add_video_frame() data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Shapes/' # Create an instance of Presentation class pres = Rjb::import('com.aspose.slides.Presentation').new # Get the first slide sld = pres.getSlides().get_Item(0) # Add Video Frame vf = sld.getShapes().addVideoFrame(50, 150, 300, 150, data_dir + "Wildlife.mp4") # Set Play Mode and Volume of the Video vf.setPlayMode(Rjb::import('com.aspose.slides.VideoPlayModePreset').Auto) vf.setVolume(Rjb::import('com.aspose.slides.AudioVolumeMode').Loud) # Write the presentation as a PPTX file save_format = Rjb::import('com.aspose.slides.SaveFormat') pres.save(data_dir + "VideoFrame.pptx", save_format.Pptx) puts "Added video frame to slide, please check the output file." end |
#initialize ⇒ Object
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/asposeslidesjava/Shapes/frame.rb', line 3 def initialize() # Adding Picture Frame to Slide add_picture_frame() # Adding Audio Frame to Slide add_audio_frame() # Adding Audio Frame to Slide add_video_frame() end |