command line multiple pnm conversion to single pdf file

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

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:

ImageMagick, RMagick, Kubuntu

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem

You want to use the rmagick gem in your rails application after a new (K)ubuntu system installation, but the bundler command gives you errors.

 

Solution

Install the following before running budler again:

ImageMagick, RMagick, Debian installation

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You want to use the rmagick gem in your ruby on rails project, but you need to install the imagemagick first.

Solution
If Imagemagick is not already installed, use the following to install it:
$ sudo apt-get install imagemagick$ sudo apt get install libmagick-dev libmagickwand-dev

You should then be able to install and use the rmagick gem

ImageMagick, RMagick, Mandriva 64 installation

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You want to use the rmagick gem in your ruby on rails project, but you need to install the imagemagick first.

Solution
If Imagemagick is not already installed, use the following to install it:
$ sudo urpmi imagemagick$ sudo urpmi lib64magick-devel

You should then be able to install and use the rmagick gem

undefined method ‘remap’ for class ‘Magick::Image’

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

Problem
You have just deployed your rails application to dreamhost but you are getting this error from passenger.

Solution
There was a change in the ImageMagic between versions 6.4.3 and 6.4.4 from the affinity function to remap.
If you don’t want, or don’t have time to recompile the ImageMagick and install the rmagick gem, you can comment out the two declarations for the alias functions, located around lines 782 and 1525 in the file rmagick-2.12.2/lib/RMagick.rb:

alias_method :affinity, :remap

Pdf with .doc templates using prawn in Ruby on Rails

Email this to someoneShare on Google+Share on FacebookTweet about this on TwitterShare on LinkedIn

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] …