Module: Asposeslidesjava

Defined in:
lib/asposeslidesjava.rb,
lib/asposeslidesjava/version.rb,
lib/asposeslidesjava/helloworld.rb,
lib/asposeslidesjava/Shapes/frame.rb,
lib/asposeslidesjava/Text/wordart.rb,
lib/asposeslidesjava/Text/textfont.rb,
lib/asposeslidesjava/Tables/addimage.rb,
lib/asposeslidesjava/Text/importhtml.rb,
lib/asposeslidesjava/Text/managefont.rb,
lib/asposeslidesjava/Text/managetext.rb,
lib/asposeslidesjava/Text/paragraphs.rb,
lib/asposeslidesjava/Charts/errorbars.rb,
lib/asposeslidesjava/Shapes/findshape.rb,
lib/asposeslidesjava/Shapes/oleobject.rb,
lib/asposeslidesjava/Slides/addslides.rb,
lib/asposeslidesjava/Slides/thumbnail.rb,
lib/asposeslidesjava/Tables/aligntext.rb,
lib/asposeslidesjava/Text/replacetext.rb,
lib/asposeslidesjava/Presentation/zoom.rb,
lib/asposeslidesjava/Shapes/cloneshape.rb,
lib/asposeslidesjava/Shapes/embedvideo.rb,
lib/asposeslidesjava/Shapes/groupshape.rb,
lib/asposeslidesjava/Slides/background.rb,
lib/asposeslidesjava/Slides/hyperlinks.rb,
lib/asposeslidesjava/ActiveX/addactivex.rb,
lib/asposeslidesjava/Charts/chartlegend.rb,
lib/asposeslidesjava/Charts/chartseries.rb,
lib/asposeslidesjava/Charts/createchart.rb,
lib/asposeslidesjava/Shapes/formatlines.rb,
lib/asposeslidesjava/Slides/cloneslides.rb,
lib/asposeslidesjava/Slides/creatingsvg.rb,
lib/asposeslidesjava/Slides/transitions.rb,
lib/asposeslidesjava/Tables/createtable.rb,
lib/asposeslidesjava/Text/createtextbox.rb,
lib/asposeslidesjava/Text/shadoweffects.rb,
lib/asposeslidesjava/Slides/accessslides.rb,
lib/asposeslidesjava/Slides/removeslides.rb,
lib/asposeslidesjava/SmartArt/fillformat.rb,
lib/asposeslidesjava/Charts/existingchart.rb,
lib/asposeslidesjava/Shapes/connectshapes.rb,
lib/asposeslidesjava/Shapes/fillingshapes.rb,
lib/asposeslidesjava/Slides/sizeandlayout.rb,
lib/asposeslidesjava/SmartArt/addsmartart.rb,
lib/asposeslidesjava/Shapes/rotatingshapes.rb,
lib/asposeslidesjava/Shapes/shapethumbnail.rb,
lib/asposeslidesjava/Tables/clonerowcolumn.rb,
lib/asposeslidesjava/Text/exporttexttohtml.rb,
lib/asposeslidesjava/Charts/chartproperties.rb,
lib/asposeslidesjava/Charts/charttrendlines.rb,
lib/asposeslidesjava/Presentation/odptopptx.rb,
lib/asposeslidesjava/Presentation/ppttopptx.rb,
lib/asposeslidesjava/Shapes/addellipseshape.rb,
lib/asposeslidesjava/Shapes/addinglineshape.rb,
lib/asposeslidesjava/Shapes/shapeproperties.rb,
lib/asposeslidesjava/Tables/removerowcolumn.rb,
lib/asposeslidesjava/Charts/setlabeldistance.rb,
lib/asposeslidesjava/Presentation/properties.rb,
lib/asposeslidesjava/Slides/changingposition.rb,
lib/asposeslidesjava/Charts/setpiechartcolors.rb,
lib/asposeslidesjava/Shapes/addrectangleshape.rb,
lib/asposeslidesjava/VBAMacros/removevbamacro.rb,
lib/asposeslidesjava/Presentation/convertingtopdf.rb,
lib/asposeslidesjava/Presentation/convertingtoxps.rb,
lib/asposeslidesjava/Presentation/convertingtohtml.rb,
lib/asposeslidesjava/Presentation/convertingtotiff.rb,
lib/asposeslidesjava/Charts/formattingchartentities.rb,
lib/asposeslidesjava/Presentation/convertingtonotes.rb

Defined Under Namespace

Modules: AccessSlides, AddActiveX, AddEllipseShape, AddImage, AddRectangleShape, AddSlides, AddSmartArt, AddingLineShape, AlignText, Background, ChangingPosition, ChartLegend, ChartProperties, ChartSeries, ChartTrendLines, CloneRowColumn, CloneShape, CloneSlides, ConnectShapes, ConvertingToHtml, ConvertingToNotes, ConvertingToPdf, ConvertingToTiff, ConvertingToXps, CreateChart, CreateTable, CreateTextBox, CreatingSvg, EmbedVideo, ErrorBars, ExistingChart, ExportTextToHtml, FillFormat, FillingShapes, FindShape, FormatLines, FormattingChartEntities, Frame, GroupShape, HelloWorld, Hyperlinks, ImportHtml, ManageFont, ManageText, OdpToPptx, OleObject, Paragraphs, PptToPptx, Properties, RemoveRowColumn, RemoveSlides, RemoveVBAMacro, ReplaceText, RotatingShapes, SetLabelDistance, SetPieChartColors, ShadowEffects, ShapeProperties, ShapeThumbnail, SizeAndLayout, TextFont, Thumbnail, Transitions, WordArt, Zoom

Constant Summary collapse

VERSION =
'0.0.2'

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.aspose_slides_configObject

Returns the value of attribute aspose_slides_config.



9
10
11
# File 'lib/asposeslidesjava.rb', line 9

def aspose_slides_config
  @aspose_slides_config
end

Class Method Details

.configure_aspose_slides(config) ⇒ Object



67
68
69
# File 'lib/asposeslidesjava.rb', line 67

def self.configure_aspose_slides config
  Asposeslidesjava.aspose_slides_config = config
end

Instance Method Details

#initialize_aspose_slidesObject



12
13
14
15
16
17
18
19
# File 'lib/asposeslidesjava.rb', line 12

def initialize_aspose_slides
  aspose_jars_dir = Asposeslidesjava.aspose_slides_config ? Asposeslidesjava.aspose_slides_config['jar_dir'] : nil  
  aspose_license_path = Asposeslidesjava.aspose_slides_config ? Asposeslidesjava.aspose_slides_config['license_path'] : nil
  jvm_args = Asposeslidesjava.aspose_slides_config ? Asposeslidesjava.aspose_slides_config['jvm_args'] : nil
  
  load_aspose_jars(aspose_jars_dir, jvm_args)
  load_aspose_license(aspose_license_path)
end

#input_file(file) ⇒ Object



50
51
52
# File 'lib/asposeslidesjava.rb', line 50

def input_file(file)
  Rjb::import('java.io.FileInputStream').new(file)
end

#load_aspose_jars(aspose_jars_dir, jvm_args) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/asposeslidesjava.rb', line 31

def load_aspose_jars(aspose_jars_dir, jvm_args)
  if aspose_jars_dir && File.exist?(aspose_jars_dir)
    jardir = File.join(aspose_jars_dir, '**', '*.jar')
  else
    jardir = File.join(File.dirname(File.dirname(__FILE__)), 'jars', '**', '*.jar')
  end

  if jvm_args
    args = jvm_args.split(' ') << '-Djava.awt.headless=true'
    logger = Logger.new(STDOUT)
    logger.level = Logger::DEBUG
    logger.debug("JVM args : #{args}")
    Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=args)
  else
    Rjb::load(classpath = Dir.glob(jardir).join(':'), jvmargs=['-Djava.awt.headless=true'])
  end

end

#load_aspose_license(aspose_license_path) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/asposeslidesjava.rb', line 21

def load_aspose_license(aspose_license_path)
  if aspose_license_path && File.exist?(aspose_license_path)
    set_license(File.join(aspose_license_path))
  else
    logger = Logger.new(STDOUT)
    logger.level = Logger::WARN
    logger.warn('Using the non licensed aspose jar. Please specify path to your aspose license directory in config/aspose.yml file!')
  end
end

#set_license(aspose_license_file) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/asposeslidesjava.rb', line 54

def set_license(aspose_license_file)
  begin
    fstream = input_file(aspose_license_file)
    license = Rjb::import('com.aspose.api.License').new()
    license.setLicense(fstream)
  rescue Exception => ex
    logger = Logger.new(STDOUT)
    logger.level = Logger::ERROR
    logger.error("Could not load the license file : #{ex}")
    fstream.close() if fstream
  end
end