view · edit · sidebar · attach · print · history

20120503-ydocx-patinfo

<< | Index | >>


Summary

  • Added Fachinfo chapter suppor
  • Added image support

Commits

Index


Add Fachinfo chapters

  • wirklungen -> wirkungen
  • Während -> wärend
  • / meens "or" z.B. Eingenommem/Anwendet

Add image support

Added image support.

copied image file into _files directory from docx.

      FileUtils.mkdir @files unless @files.exist?
      @zip = Zip::ZipFile.open(@path.realpath)
      @pictures.each do |pic|
        pic_path = Pathname.new pic # id/filename.ext
        pic_dir = @files.join pic_path.dirname
        FileUtils.mkdir pic_dir unless pic_dir.exist?
        binary = @zip.find_entry("word/media/#{pic_path.basename}").get_input_stream
        @files.join(pic_path).open('w') do |f| 
          f.puts binary.read
        end 
      end 
      @zip.close
NOTE

If overwrite .docx file with liberoffice, then all images are gone.
(word/media directory and entries in document.xml.rels)


Convert wmf format

Magick::ImageList
"WMF"
#<Pathname:rid8/image1.png>
/home/yasu/Documents/workspace/ywesee/ydocx/repo/lib/ydocx/document.rb:87:in `write': WriteBlob Failed `rid8/image1.png' @ error/png.c/MagickPNGErrorHandler/1728 (Magick::ImageMagickError)

create image from blob data with RMagick. (use to_blob)

image = Magick::Image.from_blob(File.read('/path/to/image.wmf')).first
image.format # => "WMF"
image.format = "PNG"
File.open('image.png','wb') do |f|
  f << image.to_blob
end

Refs


logo at mail_order_price

ch.oddb> registration('47551').sequence('01').packages.values.last.add_mail_order_price('9.99', 'http://www.ywesee.com', 'Logo_R.jpg')
-> #<ODDB::Package:0xb6522cc>
ch.oddb> registration('47025').sequence('02').packages.values[1].add_mail_order_price('7.90', 'http://www.ywesee.com', 'zurRose.jpg')
-> #<ODDB::Package:0xc319974>
ch.oddb> registration('41810').sequence('01').packages.values.last.delete_all_mail_order_prices

Refs

view · edit · sidebar · attach · print · history
Page last modified on May 03, 2012, at 08:07 PM