Generating and Uploading a PDF

Last updated on June 26, 2024.

This guide demonstrates generating and uploading a PDF file using Insites.

Prerequisites

To fully grasp the content of this tutorial, it is required that you possess a certain level of familiarity with Database Items, Tables, and uploads, as it is intended for individuals with advanced knowledge in these areas.

Steps

The following steps generate and upload a PDF file to s3:

  • Step 1: Create a Table
  • Step 2: Generate a PDF file and upload it to S3
  • Step 3: Access the PDF file

Step 1: Create a Table

Start with a Table like this:

app/schema/model_with_upload.yml

Step 2: Generate a PDF file and upload it to S3

Once you have the Table defined in step 1, you can generate a PDF and upload it to S3 from an HTML source by passing the HTML code in .
sets an expiration timeout for the download link in seconds.

app/graphql/generate_pdf.graphql

Important

The maximum allowable file size for PDF uploads is . Please visit the User Uploads Introduction article for more details on file uploads and how they work.

Step 3: Access the PDF file

If successful, the mutation will return something similar to this:

The link in will be available for the number of seconds previously specified in . You may still get the S3 link after the expiration time by using the following query but don't forget to set a new, non-zero expiration time, otherwise, the file will not be accessible:

app/graphql/get_pdf_requests.graphql

Note

To change the PDF's orientation, set the page size in your css to landscape:

Have a suggestion for this page?

Didn't quite find what you are looking for or have feedback on how we can make the content better then we would love to hear from you. Please provide us feedback and we will get back to you shortly.