To convert an xlsx file to csv in command line, you can use the following if you have libreoffice installed
libreoffice --headless --convert-to csv file.xlsx
To convert an xlsx file to csv in command line, you can use the following if you have libreoffice installed
libreoffice --headless --convert-to csv file.xlsx
Problem
You have multiple scanned images as pnm files, and you would like to convert them to a single pdf file.
Solution
If you have imagemagick installed you should be able to use the convert as follows to combine the images to one pdf file:
convert image1.pnm image2.pnm image3.pnm output.pdf
Problem
You want to generate pdf documents in your Ruby on Rails app using .doc templates.
Solution
Open the .doc document in OpenOffice and save it as an Open Document Format (.odt).
Open the saved .odt document and export to pdf, making sure you use ‘Losless compression’ in the General Options section.
Use imagemagick’s convert to make the pdf file to an image (setting the density to your requirements – default is 72dpi):
convert -density 150 one.pdf one.png
Copy the image one.png to your rails image directory (public/images).
Use the image as a background to the pdf created by prawnto (install plugin if you don’t have it) with:
templ=”#{RAILS_ROOT}/public/images/one.png”
pdf.image(templ, {:position => :center, :vposition => :top, :scale => 0.215})
Put the database field(s) text on position (you’ll have to play around with the coordinates to get it right), like:
pdf.font “#{Prawn::BASEDIR}/data/fonts/DejaVuSans.ttf”, :size => 9
pdf.text “#{@model_name.fielda_name}”, :at => [100,530]
pdf.text “#{@model_name.fieldb_name}”, :at => [100,510] …