PDF Receipts Discussion
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
Is it possible to render the pdf without controller? maybe sending out via emails, or saving to s3
Can you give me direction on using "endless scrolling in rails" instead of pagination.
Thanks in advance.
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.
I love wkhtmltopdf. It has saved my ass on a bunch of projects in the past. It's become my goto for PDF generation in almost any language I use. Prawn is a pain in the butt, I've used it on two projects and it has been very painful, but you do get a lot of control.
I will check it out! I did some research and can't remember why I picked prawn other than I saw enough other people using it and documentation seemed robust. That said, I bet wkhtmltopdf is way easier now that I've used Prawn more than a little.
The hardest part was building our completion certificates at OneMonth.com in Prawn. It was is finicky and time consuming.
I'm sure you're aware of livecoding.tv, 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: https://github.com/excid3/r...
Hi, I'm not familiar with extending a class from a gem. I tried to copy your gem receipt.rb into my models folder, but no change I make to the style in this receipt.rb will have any effect. What do I do wrong?
Thanks a lot
You basically need to just copy paste the module and class into a file in your app (say config/initializers/receipts.rb) and then override the methods you want to change inside the class. You can also copy and paste the entire file there into your app if you want to modify all of it.
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