Adding image in pdf using pdf writer

Hi,

I am using this code, but I am not able to add the image in pdf using
pdf writer.
Is there any wrong with code?

def pdf1
_pdf = PDF::Writer.new
_pdf.select_font “Times-Roman”
_pdf.text “Hello, Ruby.”, :font_size => 72, :justification =>
:center
_pdf.image “http://localhost:3001/images/rails.png
send_data _pdf.render, :filename => “hello.pdf”,
:type => “application/pdf”
end
I am getting this error:-
“PNG alpha channel transparency is not supported; only palette
transparency is supported.”

Please help me to solve this problem.

Thanks,
Tushar

Pretty straightforward error. You need to make sure you’re using a PNG
without alpha-transparency (24-bit uses them, 8-bit doesn’t.)

Jack B. wrote:

Pretty straightforward error. You need to make sure you’re using a PNG
without alpha-transparency (24-bit uses them, 8-bit doesn’t.)

Hi,
Is there no way to support those images?
Thanks,
Tushar

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs