Question

PDFkit doesn't get <div> elements at all, IMGkit renders blank images (the below method):

def png
  file = Tempfile.new(Digest::MD5.hexdigest(rand(12).to_s), :encoding => 'ascii-8bit')
  file.write(IMGKit.new(request.referer).to_png)
  send_data file, :filename => "test.png"
end

Is there any reliable to get a copy of any given page in an app? Format doesn't matter too much but PDF would be ideal.

Was it helpful?

Solution

Try

kit = IMGKit.new(request.referer, height: 900, transparent:true, quality:10) /*YOUR SETTING*/

file = kit.to_file(Rails.root + "public/pngs/" + "screenshot.png") /*YOUR IMAGE NAME*/
send_file("#{Rails.root}/public/pngs/screenshot.png", :filename => "screenshot.png", :type => "image/png",:disposition => 'attachment',:streaming=> 'true') /*YOUR ADDRESS WHERE U WANT TO STORE PNG FILE*/
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top