0

I know there are several questions similar to this on stack overflow, but none seem to answer my question. The wkhtmltopdf tool apparently doesn’t know about the rails asset pipeline, and wickedPDF tries to accommodate for this by finding and managing the location of assets like images with helper methods like wicked_pdf_image_tag. However, I can’t seem to get PDFs to include images from the asset pipeline in production on Heroku. The first time around, I just gave up and pulled them from S3. I guess I can still do that but would like to figure this out.

These two view method calls work in development, but not production:

<%= image_tag image_url(@logo), style: “height:121px;” %>
<%= wicked_pdf_image_tag image_url(@logo), style: “height:121px;” %>

In development, the src those tags generate works: src=“http://localhost:3000/assets/workslogo.png”

On Heroku in prod: src=“http://www.myapp.com/images/workslogo.png”

The error on the server is:
ActionController::RoutingError (No route matches [GET] “/images/workslogo.png”)

Any help is sincerely appreciated.

Thanks!

  • Mike
mb52089
  • 872
  • 2
  • 10
  • 24

1 Answers1

0

I figured out the problem. Some of the images in the app/assets/images folder had, at one point, some filenames with capital letters in them. between rails, heroku and my local mac file system some where case sensitive and some weren't. So I changed the filenames to all lowercase, which was the start of my problem. Somehow, the precompiled assets of the changed filenames didn't get re-compiled when their filenames where changed (ostensibly because the system wasn't case sensitive). I inserted an underscore in each of the filenames which forced precompile on the server, which solved the problem.

mb52089
  • 872
  • 2
  • 10
  • 24