Ask A Question


You’re not receiving notifications from this thread.

PDF Receipts Discussion

Discussion for PDF Receipts

hashes are ordered too (for the design choice) i think since ruby 1.9 the only real difference is that "keys" can be duplicated in the array style


Ah yeah, you're right. I have always been careful about hashes when it comes to ordering because I wasn't sure it was a requirement for the ruby implementation.


Is it possible to render the pdf without controller? maybe sending out via emails, or saving to s3


Yep, you can call the "render" method like you normally would and send it as an attachment to email or upload it to S3

Anshul Garg Anshul Garg

Can you give me direction on using "endless scrolling in rails" instead of pagination.
Thanks in advance.


You might check out this gem:


This is a pretty nice way to create PDF receipts . Have you tried using and


I haven't yet, but really want to. Obviously the HTML to PDF will be way easier than how Prawn does it. The programmatic generation is no fun at all.

Routine Tracker Routine Tracker

Hey Chris,

I'm sure you're aware of, but I think it would be awesome for you to livestream the creation of gems like this so we can see the process. Plus, then we'd have the recorded streams to go back to and reference.

There aren't very many Rails streams, so it would also be a great opportunity to gain some followers for GoRails!


Hey, the gem it's pretty nice, I'll try with a project that i'm working, but i have a question first, Can I put footer and header to the PDF as Prawn gem?.


It's basically designed to be simpler rather than customizable, but you can take the PDF code that's in the gem and adapt it easily to add your own header and footer. Take a look at this code:


How to make a receipt from a form after client clicked submit button?



Do you think it's possible to generate a new receipt everytime the customer get charged?
I assume there's something to do with the transaction logs to automate this?

TY and good job! ;)


Yeah! So normally with subscriptions, I listen to the charge.created webhook and save a copy of it to the database as a Charge record. That's like the example I use. The reason for needing the webhook is that subscriptions charge the user monthly and they don't have to initiate anything in your app.

For one-time charges, you can create a Charge object immediately during checkout and use that.

And if you want to store the receipt PDF files instead of generating them dynamically each time, you can save the file it generates to S3 and save it using Shrine or Carrierwave, etc and just link to that file from your view.


Hello, Great lesson. I am bigger at rails so I want to know to add line_items array in your receipts thanks

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,969+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.