There are many gems which are used for generating PDF such as “prawn”,”wicked_pdf” and “pdf-kit”
but here i show you how we can generate pdf attachement mail using wicked_pdf.
mail(:subject => ‘Your Subject’, :to => email, :from => sender_email) do |format|
attachments[“attachement_name.pdf”] = WickedPdf.new.pdf_from_string(
render_to_string(:pdf => “receipt”, :template => ‘mailer_view/mailer_action.pdf.erb’)
by this we can generate an email which render html view as well as send pdf attachment to the recepient user.