Please teach me How to save PDF files to amazon S3

13 views
Skip to first unread message

Christopher Jones

unread,
Oct 12, 2021, 3:31:02 AM10/12/21
to Prawn
Nice to meet you.

Please teach me How to save  PDF files to amazon S3.
I wan't when I click the button on the website, a PDF will be created and to save it to S3.
But PDF is not created and becomes nil.

If  don't save to S3, "send_data pdf.render" can be done without any problem.

```contoller

class UsersController < ApplicationController

  @event = Event.find(params[:event_id])
  pdf = CreatePdf.new(@supporters,@event)
  @event.update(
    pdf_S3:pdf  #using carrierwave
  )
end

```
```create_pdf.rb

class CreatePdf < Prawn::Document

  def initialize(supporters, event)
    super(
    page_size: 'A4',
    top_margin: 40,
    bottom_margin: 30,
    left_margin: 50,
    right_margin: 50
      )
  end
 #others
end
` ` `  

```development environment
ruby '2.7.1'
rails '5.2.5'
prawn '2.4.0'

I am in great trouble.
help me please.

Reply all
Reply to author
Forward
0 new messages