Sha256: 0cf23549ee4a7ca97c043048d9828df1e2f2ed33e88beb4c089fd858f9bfa7e5

Contents?: true

Size: 729 Bytes

Versions: 3

Compression:

Stored size: 729 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.push "#{Dir.pwd}/lib"
require 'goldendocx'
require 'open-uri'

docx = Goldendocx::Docx.new("#{Dir.pwd}/demo/templates/blankDocument.docx")

image = File.open("#{Dir.pwd}/demo/templates/bg.png")
docx.create_image(image)

image_base64 = File.read("#{Dir.pwd}/demo/templates/image_base64")
docx.create_image(image_base64)

image_url = 'https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png'
docx.create_image(Kernel.open(image_url))

filename = 'simpleImageDocument.docx'
system "rm -f ~/Desktop/#{filename}" # -f so that we don't have an error if the file doesn't exist
docx.write_to File.expand_path("~/Desktop/#{filename}")
exec "open ~/Desktop/#{filename}"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
goldendocx-0.3.0 demo/images/append_image.rb
goldendocx-0.2.3 demo/images/append_image.rb
goldendocx-0.2.2 demo/images/append_image.rb