PDF Preview Mode

It would be great to have an option to select when a PDF DOCUMENT link is selected it will open in Preview mode instead of being downloaded.

Hi! Welcome to the community :wave:

If you double click on the Print PDF component you’ll see an option to change it from print or download. Print opens it up to print/preview.

What about a DOWNLOAD Link in a table whereby a user has uploaded a file - it downloads the file - it would be great to set it to PDF Preview.

This can be done with a list component using the HTML option.

After creating your PDF open one of them and take note of the URL. For example

https://tutorials.tadabase.io/app/APP_ID/pages/TABLE_ID-RECORD_ID.pdf

Next, take out the record id and replace it with {!!id!!}

https://tutorials.tadabase.io/app/APP_ID/pages/TABLE_ID-{!!id!!}.pdf

Now that we have that, add ?mode=Download at the end of the link and paste it into a list components HTML option.
https://tutorials.tadabase.io/app/APP_ID/pages/TABLE_ID-{!!id!!}.pdf?mode=Download

You now have a 1 click option to download a PDF from a parent page! Do let me know if you have any questions :slight_smile:

2 Likes

It is also possible to do this with a Table component but it requires a few extra steps.

  1. Create a text field called “id” and set a table rule to set this field to the Record Id

  2. Create an Equation field with the following equation.
    Make sure you replace APP_ID and TABLE_ID with the app and table id from your PDF’s link (see the post above this one for more info)

CONCAT('<a',CHAR(32),'href="https://tutorials.tadabase.io/app/APP_ID/pages/TABLE_ID-',{id},'.pdf?mode=Download"',CHAR(32),'class="btn',CHAR(32),'btn-block',CHAR(32),'btn-primary',CHAR(32),'td-data-link">Download',CHAR(32),'PDF</a>')

  1. The equation field will now act as a download button for your PDF! Add the equation to your table and you’re done. :slight_smile:
2 Likes

Hi @Chem, why would I get a message “You don’t have permission to access this page” when I attempt to open that URL that is generated in the button? (I am logged in :slight_smile: and can view that same URL when generated from the Print Button.

This is set up intentionally this way for security reasons.

If the page has security enabled, the PDF will only work when generated from the PDF Print button.

1 Like

Thanks for confirming that @moe

Hi @Moe is there an API call I can invoke to securely retrieve the PDF and replicate the same behavior that you would have from the PRINT PDF button ?

@GREDDIE, unfortunatley there is no API to generate the PDF at this time.

We have some updates coming to PDF this week, I will probe if there is that is potentially something we can do here.

I will send you a video shortly with another potential solution.

3 Likes