![]() ![]() Note that in these last two examples, I switch out the way I get the receipt ID. Import * as functions from 'firebase-functions' So everything Firebase is up and running - that's great. Again, the documentation is great here, so if you haven't set this up before, go check out their setup guide. We'll be using the firebase-admin npm package to do a few things, and that requires a service account, and some keys in a JSON file. One thing you do need to do, however, is to create a service account. If not, go check out the Getting Started guide in the Firebase docs for a quick refresher. I'm not going to do this in this article, because by the time you read this, you probably know how to do that. The very first thing you want to do is to get your Firebase project up and running. So without further ado - let's jump in! Step 1: Set up Firebase ![]() Your use case is probably different, but as long as you want to generate a PDF, host it somewhere and (or) do all that within the confines of Firebase / Google Cloud, you're probably going to find this article useful. I needed to do this because we needed a way to generate receipts for a side project I have ( opra.no, go check it out!). And we'll add a few fancy features as we go. ![]() In this tutorial, we'll use Firebase Functions to generate a PDF document with pdfkit, upload it to Firebase Storage, and return a signed and secure URL where it can be viewed. Like, the article I wished I found when I started out. Often, when I have a hard time solving a task, I like to summarize my learnings in a blog post. ![]()
0 Comments
Leave a Reply. |