Developers · Assets
Generating and Uploading a PDF
Last updated 5 November 2026
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
name: model_with_upload
properties:
- name: the_upload
type: uploadStep 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
app/graphql/generate_pdf.graphql
mutation {
record_create(
record: {
table: "model_with_upload"
properties: [ {
name: "the_upload"
value_upload: {
type: pdf
content: "<html><head><title>Test PDF</title></head><body><h2>This will be the content of the pdf</h2></body></html>"
}
} ]
}
) {
id
url: property_upload(name:"the_upload", expires_in: 600) {
extension
file_name
url
versions
}
}
}Important
The maximum allowable file size for PDF uploads is
Step 3: Access the PDF file
If successful, the mutation will return something similar to this:
"data": {
"record_create": {
"id": "118",
"url": {
"extension": "pdf",
"file_name": "the_upload.pdf",
"url": "https://s3-us-west-2.amazonaws.com/uploads.staging.oregon.insites.site/instances/xx/property_uploads/custom_uploads/file/xxxx-xxxxxx/the_upload.pdf?xxxxx",
"versions": {}
}
}
}
}The link in
app/graphql/get_pdf_requests.graphql
query {
records(
per_page: 3
filter: {
id: { value: 57 } # use this if the id is known
table: { value: "model_with_upload" }
}
) {
results {
id
url: property_upload(name:"the_upload", expires_in: 600) {
extension
file_name
url
versions
}
}
}
}Note
To change the PDF's orientation, set the page size in your css to landscape: