Sha256: 1c8ed7443db8025a76de6035d5131d430887fcd336f42f8bf4158146ca6d93e5

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

module Asposeslidesjava
  module ManageFont
    def initialize()
        # Replacing Fonts Explicitly Inside Presentation
        replace_font()
    end
    
    def replace_font()    
        data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/Text/'
                
        # Create an instance of Presentation class
        pres = Rjb::import('com.aspose.slides.Presentation').new(data_dir + 'input.pptx')

        # Load source font to be replaced
        source_font = Rjb::import('com.aspose.slides.FontData').new("Arial")
            
        # Load the replacing font
        dest_font = Rjb::import('com.aspose.slides.FontData').new("Times New Roman")
            
        # Replace the fonts
        fonts_manager = Rjb::import('com.aspose.slides.FontsManager')
        pres.fonts_manager.replaceFont(source_font, dest_font)

        # Write the presentation as a PPTX file 
        pres.save(data_dir + "ReplaceFont.pptx", Rjb::import('com.aspose.slides.SaveFormat').Pptx)

        puts "Replaced font, please check the output file."
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
asposeslidesjava-0.0.2 lib/asposeslidesjava/Text/managefont.rb
asposeslidesjava-0.0.1 lib/asposeslidesjava/Text/managefont.rb