How we added invoices to Browserling - good coders code, great reuse |
| How we added invoices to Browserling Posted: 26 Feb 2014 03:10 PM PST We recently added invoices to Browserling. I thought I'd share how we did it as it's another interesting story. Our customers keep asking for invoices all the time so we made it simple to create them. They can now just go to their Browserling accounts and download them. Here's how an invoice looks like:
And here are the implementation details. We use a node module called invoice. The invoice module takes a hash of invoice details, internally spawns var invoice = require('invoice'); invoice( { template: 'browserling-dev-plan.tex', from: "Browserling inc\\\\3276 Logan Street\\\\Oakland, CA 94601\\\\USA", to: "John Smith\\\\Corporation Inc.", period: "2/2013", amount: "$20" }, function (err, pdf) { if (err) { console.log("Failed creating the invoice: " + err); return; } console.log("Pdf invoice: " + pdf); } ); The \documentclass[12pt]{article} \pagenumbering{gobble} \begin{document} \begin{center} \Large{\textbf{Invoice}} \\ \vspace{0.5cm} \large{Subscription to Browserling's Developer Plan} \end{center} \vspace{1cm} \section*{Invoice from:} %from% \section*{Invoice to:} %to% \section*{Period:} %period% \section*{Amount:} %amount% \end{document} Once the pdf invoice is generated, we create a token that maps to the pdf file, and once it's requested, we send it to the customer as an application/pdf. Until next time! |
| You are subscribed to email updates from good coders code, great reuse To stop receiving these emails, you may unsubscribe now. | Email delivery powered by Google |
| Google Inc., 20 West Kinzie, Chicago IL USA 60610 | |
No comments:
Post a Comment
Keep a civil tongue.