Multiple PDF Generator

Need the ability to generate different PDFs from the same Table. Wondering if anybody has managed to achieve that? Thought Integromat/Eledo might provide an option but passing the document back is proving problematic. Are Pipes an option?

1 Like

I’m using Integromat and Eledo, what problems are you having passing the document back to Tadabase?

1 Like

Hi @tim.young it’s the last leg. I can generate the PDF and create the record in Tadabase but it’s passing the actual PDF doc back to Tadabase which is missing.

Here is the scenario

Here is the last module

field_185 is the document column and it’s that which fails. If i take it out it works but I don’t have the document attached

@Scott Ah right. So I don’t think document uploading is available through the Tadabase API.

What I do is upload the document to Dropbox, create a sharing link, and send the link to Tadabase in a link feld.

1 Like

Ok thanks @tim.young hoping there is another option as I’m finding the PDF generation limiting

Agreed!

I’ve also been using Integromat + Google Docs. You can map fields to replace placeholder tags in a Google Doc.

1 Like

Not sure if this is still helpful, but you can use a pipe too to create a PDF. Eledo API responds with the file URL which you can save to your database.

Here’s what that pipe can look like:

If you wanted to really take this a step further you can do the following:

  1. Create your unique PDF pages in Tadabase
  2. Use convertapi to upload the file dynamically by passing the record id as a parameter for the URL.
  3. Use ConvertAPI to convert the uploaded file into pdf which will return a Base64 value.
  4. Save the Base64 value to your table
  5. Use the sendgrid Pipe to send email with the attachment. For the attachment, content pass the Base64 value. This will send the PDF as an attachment.

Here’s a very very rough and quick video. If needed let me know and I’ll make a short video with instructions explaining this entire process.

4 Likes

I would like to see more of this.

As would I. I have an application that currently has multiple tables included on a Details page and being able to convert all of the table entries into a single PDF is my ultimate need.

@moe, this is linked to the Pipe you and I chatted about some weeks ago about duplicating multiple tables at the same time.

I would be interested in this as well!

Hi @moe would definitely be interested. Is there anyway of passing the doc back as a file?

Technically you can pass it back as a file link and save it to a link field. I’ll look into this some more.

I thought this would be a 5 minute video but took 15 especially since I had to do some troubleshooting along the way.

I hope this helps. In the future we’ll try and add more docs into doing this.

3 Likes

Hey Moe,

You said this could be setup in a form rule as well, would all three of these actions work if they were in the same form or would you have set it up in parts with tables rules as well?

Technically form rules and record rules work off of the same code with very few and slight differences. I believe in Record Rules you should be able to do this with one record rule, but I’d need to double check with a slow responding API call. When it comes to updating records within Tadabase not including a pipe, those for sure run in proper order.

1 Like

@moe I see in your above solution, you always save a link returned from calling a third party API like eledo. What if I am creating my own API to generate a PDF and I’d like to actually send back the file content to be saved in a database FILE field?

Ideal Solution:
Option 1-

Pipe --> POST /myowncustomAPI to generate PDF -> response (File content) -> Pipe saves the file in File field

Option 2:
Pipe -> POST /myowncustomAPI to generate PDF -> response by calling tadabase API to save the file

Option 3: Suggested above, that is to respond with a link to dropbox or Gdrive.

@hussein depending on which programing language you’re using you can do option 1 but the process of saving the PDF to file field must be done in the code when you’re using /myowncustomAPI.

So what I’m thinking is:

  1. Create a pipe that sends data to /myowncustomAPI
  2. /myowncustomAPI generates the PDF and saves it locally on the server
  3. /myowncustomAPI then uploads the saved PDF to a file field in Tadabase
  4. /myowncustomAPI sends a JSON response with success message.

Uploading file from API is a bit tricky, but here’s a PHP snippet that might help.

This relies on having
composer require pear/http_request2

Then here’s the PHP code:

<?php

require 'vendor/autoload.php';

//require_once 'HTTP/Request2.php';

$request = new HTTP_Request2();

$request->setUrl('https://api.tadabase.io/api/v1/data-tables/K68j9gN2V7/records');

$request->setMethod(HTTP_Request2::METHOD_POST);

$request->setConfig(array(

  'follow_redirects' => TRUE

));

$request->setHeader(array(

  'X-Tadabase-App-id' => 'b1r***QKk',

  'X-Tadabase-App-Key' => 'SpX*****QoiQ',

  'X-Tadabase-App-Secret' => '3HLO***********WvERh0eLT'

));

$request->addUpload('field_70', 'My-Local-File-Location.pdf', 'filename.pdf', '<Content-Type Header>');

try {

  $response = $request->send();

  if ($response->getStatus() == 200) {

    echo $response->getBody();

  }

  else {

    echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .

    $response->getReasonPhrase();

  }

}

catch(HTTP_Request2_Exception $e) {

  echo 'Error: ' . $e->getMessage();

}
1 Like