Last active
May 20, 2018 20:25
-
-
Save originalusername123/6b7ef310e5dabf938c0ec60b50434ef8 to your computer and use it in GitHub Desktop.
caracal-embedimage-windows-simplest-example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
APP_ROOT = File.dirname(__FILE__) | |
$:.unshift(File.join(APP_ROOT, 'lib')) | |
require 'caracal' | |
Caracal::Document.save "superproject.docx" do |docx| | |
require 'base64' | |
data = File.open('lib\imagejpg.jpg', 'rb').read | |
finaldata = Base64.encode64(data) | |
print "The content of finaldata is #{finaldata}" | |
docx.img 'lib\imagejpg.jpg', data: finaldata, width: 400, height: 400, align: :right | |
docx.page | |
data2 = File.open('lib\imagepng.png', 'rb').read | |
finaldata2 = Base64.encode64(data2) | |
print "The content of finaldata is #{finaldata2}" | |
docx.img 'lib\imagepng.png', data: finaldata2, width: 400, height: 400, align: :right | |
end | |
system("start superproject.docx") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment