You are not logged in.

#1 2012-08-21 22:47:37

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Ruby: PDF::Writer can't read JPG or PNG files?

require 'pdf/writer'
pdf = PDF::Writer.new
pdf.image('/home/max/pics/kiwi.png')

Results in:

RuntimeError: Unsupported Image Type
from /home/max/.gem/ruby/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer/graphics.rb:668:in `image'

Why?

edit - can't get rid of that mysterious newline in the code snippet ... weird? oh well, you get the idea

Last edited by synthead (2012-08-21 22:48:47)

Offline

#2 2012-08-22 07:21:34

answer_42
Member
From: Steenbergen, Netherlands
Registered: 2010-06-28
Posts: 8

Re: Ruby: PDF::Writer can't read JPG or PNG files?

Hello,

I don't know about this error, but PDF::Writer is unsupported and it is recommended to use  Prawn[1].

Couldn't the problem be that you are using Ruby 1.9.1 and PDF::Writer written for 1.8(just a guess).

Sebastian
[1] http://prawn.majesticseacreature.com/

Offline

Board footer

Powered by FluxBB