A Ruby pdf writer that supports images

Hello list,

I am developing a site page where there's a link that create an invoice
report converted to a pdf file, but there's one problem I realized
using PDF::Writer, it has no support for images.

Is there any solution or alternative API for ruby where it supports
images?

I have searched the net (guessed im not good at it :slight_smile: ), and found out
that PDF:Writer the best I can get (accdg. to my searching ability),
but it's not that mature yet.

any suggestion guys? thanks in advance!

Artotoy

Since this is server side, you could probably call out to an external
utility to generate the pdf (I've done this in the past using lout and
ps2pdf) and then pick it up from your ruby program.

martin

路路路

arthur.olano@gmail.com <arthur.olano@gmail.com> wrote:

I am developing a site page where there's a link that create an invoice
report converted to a pdf file, but there's one problem I realized
using PDF::Writer, it has no support for images.

Arthur,

I am in the process of porting fpdf (http://fpdf.org) to Ruby. It will support JPG first then PNG. It's working for simple stuff but has a couple of bugs that I will work out in the next two weeks or so for more advanced features.

Dan

路路路

arthur.olano@gmail.com wrote:

Hello list,

I am developing a site page where there's a link that create an invoice
report converted to a pdf file, but there's one problem I realized
using PDF::Writer, it has no support for images.

Is there any solution or alternative API for ruby where it supports
images?

I have searched the net (guessed im not good at it :slight_smile: ), and found out
that PDF:Writer the best I can get (accdg. to my searching ability),
but it's not that mature yet.

any suggestion guys? thanks in advance!

Artotoy

I've used images in pdf-writer:
http://rubyforge.org/projects/ruby-pdf/

Get the CVS snapshot though, Austin has integrated a couple of patches
that aren't in a released version yet. Among them are the image
support...

//F

路路路

On Mon, 7 Feb 2005 13:55:10 +0900, arthur.olano@gmail.com <arthur.olano@gmail.com> wrote:

I am developing a site page where there's a link that create an invoice
report converted to a pdf file, but there's one problem I realized
using PDF::Writer, it has no support for images.

arthur.olano@gmail.com ha scritto:

any suggestion guys? thanks in advance!

I can think of this thread:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/116020

HTH

To martin:

I really appreciate your suggestion thanks! I did go digging into it
but one problem I found out, it still has no support on image
insertion... :frowning: but thanks, at least my focus is on lout and ps2pdf now
:slight_smile:

To Dan:

"I am in the process of porting fpdf (http://fpdf.org) to Ruby. It will
support JPG first then PNG. It's working for simple stuff but has a
couple of bugs that I will work out in the next two weeks or so for
more
advanced features. "

after a whole day searching for an answer on "how to insert an image to
a pdf", i guess the answer is here again hehehe I guess i have to try
this out :slight_smile:
thanks!

Artotoy

Mmm. I thought that I had released a new version. I will add this to
my list of things to do over the next two weeks.

-austin

路路路

On Tue, 8 Feb 2005 00:18:47 +0900, Fredrik Jagenheim <jagenheim@gmail.com> wrote:

On Mon, 7 Feb 2005 13:55:10 +0900, arthur.olano@gmail.com > <arthur.olano@gmail.com > wrote:

> I am developing a site page where there's a link that create an invoice
> report converted to a pdf file, but there's one problem I realized
> using PDF::Writer, it has no support for images.

I've used images in pdf-writer:
http://rubyforge.org/projects/ruby-pdf/

Get the CVS snapshot though, Austin has integrated a couple of patches
that aren't in a released version yet. Among them are the image
support...

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Hello again,

"I've used images in pdf-writer: "

How did you do it? if you wont mind telling me what method you're
using? Do you have a sample of any code you have used? Looking back on
the tutorial provided of the package of pdf-write, I saw
addJpegFromFile() and addImage() and their synxtax, but they were no
where to be found. my program just returns a "NoMethodError"

"Get the CVS snapshot though, Austin has integrated a couple of patches
that aren't in a released version yet. Among them are the image
support... "

There's only one module available on the cvs and i did check-out and
tried it, but all were the same :frowning: Hmmm.....what to do....?

Artotoy

How did you do it? if you wont mind telling me what method you're
using? Do you have a sample of any code you have used?

To quote an actual piece of the code:
cv.add_jpeg_from_file(textDB['Picture']['name'], 40, cur_y - 210, 155, 201)

(cv is the PDF object)

Looking back on
the tutorial provided of the package of pdf-write, I saw
addJpegFromFile() and addImage() and their synxtax, but they were no
where to be found. my program just returns a "NoMethodError"

I don't think I ever used addImage. As for addJpegFromFile, try not to
use the CamelCase. Sometimes it's not aliased.

There's only one module available on the cvs and i did check-out and
tried it, but all were the same :frowning: Hmmm.....what to do....?

Try underscore_notation instead of CamelCase. If that doesn't work,
well, we will have to take a look at it again. :wink:

If you want to use CamelCase, you could always open up the pdf object
and make a few :alias on your own, though.

Btw, the name 'cv' comes from that after my company switched names for
the third (4th?) time and I was ordered to update my profile with a
new word-template; I decided to create a template in Ruby instead with
YAML as input.
Whenever I needed to update my profile; I'd edit the YAML file and
generate a new PDF profile. Whenever the company changed template, I'd
create a new template in Ruby and run the generator again.
Perhaps not time efficient with one person; but if 10-20 persons never
had to sit through a Word session just to update their profile
again...

//F

路路路

On Tue, 8 Feb 2005 15:00:08 +0900, arthur.olano@gmail.com <arthur.olano@gmail.com> wrote: