Tiff images are not rendered when using PDFKit

345 Views Asked by At

I am using PDFKit to generate a PDF file with Tiff images

kit = PDFKit.new("<img src='test.tif'")
kit.to_file("hello.pdf")

But in the output PDF file, Tiff images are not rendered. I have tried a JPEG file. It's working perfectly. Any help would be appreciated.

1

There are 1 best solutions below

3
On

It works fine for me.

Is the image in your assets folder?

Try this...

path = Rails.root.join('app', 'assets', 'images', 'test.tif')
kit = PDFKit.new("<img src='#{path}'>")
kit.to_file("hello.pdf")