Sachin Singh
Sachin Singh

Reputation: 7225

CSS not loading in PDF generated using Grover gem in production mode

I am using grover gem to generate PDF from HTML template. Its working fine locally, but PDF looks UI less on production environment. I am using AWS cloudfront as CDN in production mode.

Here is a snippet of my code.

def download
  file_export = file_exports.find_by_guid!(params[:id])

  grover = Grover.new(file_export.data, format: 'A4')
  send_data(grover.to_pdf,
            filename: "#{file_export.sanitized_file_name}.pdf",
            type: 'application/pdf')
end

Here file content is generated using.

  file_content = action_controller.render_to_string(
    template: 'performance/reviews/combine_print',
    layout: 'pdf_layout',
    formats: [:html],
    locals: { data: @data, current_state:, participants:, current_user: current_state.user,
              current_company: current_state.company },
    assigns: { permissions:, make_anonymous: }
  )

Please suggest how to fix this UI difference.

Upvotes: 0

Views: 159

Answers (0)

Related Questions