Hey people for some reason I can’t get to edit the opening post, so I’ll insert new instructions regarding changes here.
Update: Now saving back to the database! This is a backward compatible change (non breaking change).
Yes it works on mobile browsers, just like the rest of the plugin.
So, a long awaited and much requested feature was to save our PDF files into our app’s storage.
Here it is! This is how you do it:
Step 1 is as easy as checking a box in the final workflow action. That’s what it is!
Then you click this custom event that the plugin gives you:
Then at that event you build the workflow that will execute your logic regarding how you want to save the link to the PDF file. In this picture I’m creating a sample thing I called in its data type “A file”. It’s just a thing with three text fields.
Here’s a similar logic with a few differences.
See? Just three text fields for that first example.
And a single text field on that second example.
Here’s how the first example looks in my database after the first run. Just so you see what kind of text comes from each of the options. And at what time of the day I was working on this
The text I have at the field to explain it is this one:
If this is enabled, you will be able to use this plugin’s custom event called “PDF uploaded and available in element state”, there you’ll be able to save the file’s URL to a text field in a thing in Bubble’s database.
Note that it comes like this:
//aws.com/23892378/filename so you must append the https: or http: for it to work as a link when displaying.
But I suggest you to save it in that original state, Bubble apparently uses it as it is for some things. When that event is triggered, the PDF will already be uploaded to your app’s storage and the link will be in the PDF Model element custom state called “Saved PDF’s URL”.
Note that it will be available in the same “PDF Model X” element that was used to create the file.
Also, if you want to restrict access to the file (make it private), you can. This is the explanation for it, found right below the field to attach the pdf to a thing:
Optional. Required if you want this file to be private. Else anyone with the link will be able to access it. Check https://bubble.io/reference#Elements.FileInput.attach_to and https://bubble.io/reference#Data.Privacy.permissions.view_attachments to know more.
I think this wraps it. As always, keep requests for features, bug reports and questions coming!