Reputation: 23
I am using wicked_pdf for generating pdf in my rails application.
I need to display a map on pdf with iframe.
I used bellow code for the map.
%iframe{:frameborder => "0", :height => "200", :src => "https://maps.google.com/maps?q=#{spot_details.lat}, #{spot_details.lng}&hl=es;z=14&output=embed", :style => "border:0;width:100%;margin-bottom:20px"}
But it gives me simple frame without map like this http://storage1.static.itmages.com/i/17/0515/h_1494853712_9065572_7571a033f7.png
Anyone, please suggest me how to display map on wicked_pdf with rails application.
Upvotes: 1
Views: 1016
Reputation: 18784
It appears to be working for me.
Commit adding Google map in Iframe to wicked_pdf_issues project
Resulting PDF - default style issue, but definitely working
Do you have other JavaScript or stylesheets that could be interfering?
It could be a timing issue if you have a slow connection from Google to your server.
Try increasing the default JavaScript rendering timeout with the option javascript_delay
like this:
render pdf: 'mypdf',
javascript_delay: 5000 # wait 5 seconds for JS to fully execute
Upvotes: 1