Is there a way to create a PDF using appgyver?

I wanted to create a PDF using the information that the user filled in the form :thinking:

You will need a 3rd party plugin for that, which isnt yet supported. I did discover a javascript library that would be useful if you could copy in the whole library into a javascript node:

another one…


I’m using python to get the firebase information and generate a PDF, it’s working, but thanks a lot for the links/help <3

Any information or screenshots that you can share on this would be very helpful.

This seems to be really cool, will dive more into it later…

Until then I use Google Apps Script (GAS) to generate PDF-s from the platform. It requires a little bit of coding, but is well documented.
So the flow would be like:

Create the document you want to use as the template. The information you want to change just give it some unique placeholder. I usually use a schema like this: %reference1%. Then at the top menu go to the “Extensions” tab, and then choose “Apps Script”. Give it a name and you should have something like this: [sorry my ui is in Hungarian]

Now change the “myFunction()” to “doGet(e)”. Here what happens is that we will call the script from the client app as a request. There will be for sure CORS errors using it from the preview app, but there is a workaround for that as well. e is the url query parameters.
Now write the part which gets the parameters from the request url, similarly:
Képernyőfotó 2022-02-14 - 20.53.49
Note: e.parameter gets the first value only if there are values with the same keyname. e.parameters gets all the records into an array. Give the e.parameter. part the same value as the propertyname referred to below, so that the script knows what to search for.
Now that you have your inputs in GAS you can modify it (if you wish, but I suggest doing it in Appgyver and passing only the finalised data to the script).
The next step is to get the template’s content to be able to replace the placeholders:
Képernyőfotó 2022-02-14 - 21.04.06
And finally simply use:

body.replaceText('%reference1%', yourvariablename [e.g: utasok]);

Lastly you need to export is as a PDF:

Now you have your pdf as a response. However I didn’t manage to get the pdf back to Appgyver (have not even tried to be honest). But in the script you can do the following to get the url of the new pdf:

   return ContentService.createTextOutput(response.getUrl()).setMimeType(ContentService.MimeType.TEXT);

This will return Appgyver the url that you can save to a database or send to the user or whatsoever.

The script is now done. We have to deploy it as a Web App. Remember the blue button in the top right corner. There you can deploy the script as a Web App.
For execution choose: “me” for “who has access” choose “anyone”. You will have to give permission for the script and finally you will receive a long url with ending: “exec”. We will need that later.

In Appgyver:
Get user input (there could be some difficulties with lists or arrays, but there is workaround that as well) → construct a {propertyname: how you will reference to this as a parameter in GAS, propertyvalue: information} objects which has the information you need to generate the PDF → encode it for url with the formula: ENCODE_OBJECT_FOR_URL
Now I have not solved the CORS error which I usually get if I use “HTTP request” flow function, so We will use a custom javascript now, with a “fetch” method:

let url = inputs.url;
let data =;
url = `${url}?${data}`; 

  const response = await fetch(url, {
        redirect: "follow"
      const res = await response.text();

return { result: res };

I have already changed it to a formula, but it is far away from a complete one. [there is no error handling etc… so this is not at all best practice yet]
But set the url input to the one you got from the script deployment page (the one with exec ending) and the data field to the built object from before.
Now you can get the url of the pdf as the output of the custom javascript. Bind to page variable or upload it to firebase. Whatever you wish. But the file will be generated.

*Important things to note: CORS errors still can occur. Use this Chrome extension for testing purposes: Allow CORS: Access-Control-Allow-origin :: MyBrowserAddon
Also I realised that this extension helps a lot, so in fact we could even test the script with real and good-practice-like HTTP requests with real json body. That would make so much more sense and would enable much better integration with GAS.

But for now this is my working solution to generate PDFs from the client app in Appgyver. I also use similar logic to send emails from GAS, and even generate google spreadsheets. Hope it helps.


About what do you need?

I have no idea really. I don’t even know what I don’t know at this point. I’m designing an app that will need to generate and print receipts and the only option that I’m currently capable of using is a 3rd party API integrated with my Xano back end. This will work but will become more and more expensive at scale.

1 Like