Including Image in pdf using PDFKit in Rails

I have used PDFKit gem in rails and generated a Invoice.pdf file from HTML. I am using PDFKit.new(html) and not middleware and it works.

In my view, I don't need any images to be included.But I need to add image/logo in the generated PDF file. Is it possible to include image in pdf alone? How to do it?

Answers


Try to add to images which you want to display class such as .display_in_pdf, and in your stylesheet:

@media print {
 .display_in_pdf {
    display: block;
  }
}

.display_in_pdf { 
  display: none;
}

Need Your Help

Accessing results from another method

php

Hi I'm relatively new to OOP PHP and trying to get my head around a few concepts. I have two methods one public and one private.

Xamarin.Android: Get filepath from CacheDir

android xamarin directory xamarin.android filepath

How do I get the filepath from the cache? Android: getCacheDir() / Xamarin: CacheDir. I can't find any useful information on this ...