Module: Asposeslidesjava::SizeAndLayout
- Defined in:
- lib/asposeslidesjava/Slides/sizeandlayout.rb
Instance Method Summary collapse
Instance Method Details
#initialize ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/asposeslidesjava/Slides/sizeandlayout.rb', line 3 def initialize() # Setting the Size and Type of a slide set_size_and_type() # Setting the page size when generating PDF set_page_size_for_pdf() end |
#set_page_size_for_pdf ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/asposeslidesjava/Slides/sizeandlayout.rb', line 35 def set_page_size_for_pdf() 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 # Set SlideSize.Type Property pres.getSlideSize().setType(Rjb::import('com.aspose.slides.SlideSizeType').A4Paper) # Set different properties of PDF Options opts = Rjb::import('com.aspose.slides.PdfOptions').new opts.setSufficientResolution(600) # Saving the presentation save_format = Rjb::import('com.aspose.slides.SaveFormat') pres.save(data_dir + "Export.pdf", save_format.Pdf, opts) puts "Set page size for pdf, please check the output file." end |
#set_size_and_type ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/asposeslidesjava/Slides/sizeandlayout.rb', line 11 def set_size_and_type() 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') aux_pres = Rjb::import('com.aspose.slides.Presentation').new = pres.getSlides().get_Item(0) # Set the slide size of generated presentations to that of source aux_pres.getSlideSize().setType(pres.getSlideSize().getType()) aux_pres.getSlideSize().setSize(pres.getSlideSize().getSize()) # Clone required slide aux_pres.getSlides().addClone(pres.getSlides().get_Item(0)) aux_pres.getSlides().removeAt(0) # Saving the presentation save_format = Rjb::import('com.aspose.slides.SaveFormat') pres.save(data_dir + "Slide_Size_Type.pptx", save_format.Pptx) puts "Set slide size and type, please check the output file." end |