Forum: Ruby on Rails Displaying Binary Image

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
797ff26af1f6b7f756ff9c4e2880eccb?d=identicon&s=25 Daniel.Sirz@googlemail.com (Guest)
on 2007-03-05 18:59
(Received via mailing list)
Hi There,

hopefully this is the right group to solve my Problem:

I Need to display an image in a PDF Document.

The image is created via another webseite for example:
http://xyz.com?barcode=123456

The Image to display is a barcode and its type is PNG.

All I want to do is to integrate this image into a PDF Document
(generated with pdflib).

I recieve a binary coded input stream but i don't know how to display
this in the PDF,

I would be glad if somebody could help me out.

Thanks a lot,

Daniel
21f7ed21f11a809050594c82eab11d67?d=identicon&s=25 Robert Walker (Guest)
on 2007-03-05 23:40
(Received via mailing list)
I have not yet worked with pdflib, but if you can incorporate the
image into the PDF document using an external link then here is an
example of how to provide the link:

Add a method similar to this in your controller class:
def picture
    @picture = Picture.find(params[:id])
    send_data(@picture.data,
              :filename => @picture.name,
              :type => @picture.content_type,
              :disposition => "inline")
  end

and link to it like:
/mycontoller/picture/123

On Mar 5, 12:58 pm, "Daniel.S...@googlemail.com"
This topic is locked and can not be replied to.