--- title: "Add and merge PDF files" slug: "efp-add-and-merge-pdf-files" description: "Combine multiple PDFs seamlessly with Exact Forms Plus, adding cover letters or terms to create a single, organized document effortlessly." tags: ["Quickbase Extension", "Document Generation", "Exact Forms Plus"] updated: 2026-10-09T16:21:10Z published: 2026-10-09T16:21:10Z canonical: "help.quickbase.com/efp-add-and-merge-pdf-files" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.quickbase.com/llms.txt > Use this file to discover all available pages before exploring further. # Add and merge PDF files Exact Forms Plus can put other PDF files together with the PDF it creates, so the result is one PDF. For example, you can add a cover letter in front of a quote, or your terms and conditions after an invoice. Three button parameters do this: | Parameter | Where the files go | | --- | --- | | `prefiles` | **Before** each document Exact Forms Plus creates. | | `addfiles` | **After** each document Exact Forms Plus creates. | | `mrgfiles` | At the **end of the merged document**, when one run creates documents for many records and combines them into one PDF. | The files become pages of the PDF. They aren't attached to it as separate files. ## Before you start - **PDF output only.** The button must create a PDF (`docfmt=pdf`). With Word output, these parameters are ignored. - **PDF files only.** Each file you add must be a PDF (its name ends in `.pdf`). Other file types are skipped. To combine Word, Excel, or image files, convert them first, or use PDF Merger (see [Exact Forms Plus or PDF Merger?](/quickbase-extensions/docs/efp-add-and-merge-pdf-files#compare-pdf-merger)). - **A limit on the number of files.** Your account sets how many files one parameter can list. If you list more, the run stops with *Too Many ADDFILES* (or PREFILES, or MRGFILES). - **Not in test mode.** With `test=y`, these parameters are ignored. ## Point to the files List the files in the order they should appear, separated by periods. Each entry can be one of these: | Entry | The file is in | Example | | --- | --- | --- | | A field ID | A file attachment field on the record being processed. | `109` | | `table ID:Record ID#:field ID` | A file attachment field on a record in another table, for example one standard *Terms and conditions* record. | `bxxxxxxxx:1:7` | | `table ID:RID:field ID` | The same, but `RID` is replaced with the Record ID# of the record being processed. Useful when the other table uses the same Record ID#s. | `bxxxxxxxx:RID:7` | | `FID` + a field ID | Wherever the field's value says. The field, usually a formula text field, holds one or more of the other entries (separated by periods). Exact Forms Plus reads it for each record, so each record can add different files. | `FID123` | | `S3\|` + a key | Amazon S3, in the bucket saved for your account. The key can't contain a period (see [Things to know](/quickbase-extensions/docs/efp-add-and-merge-pdf-files#things-to-know)). | `S3\|terms_2026` | For example, this button adds a cover letter from field 108 on the record before the document, and the record's attachment in field 109 plus a standard terms file after it: ```plaintext & "&docfmt=pdf" & "&prefiles=108" & "&addfiles=109." & [_DBID_TERMS] & ":1:7" ``` ### Different files for each record Use a formula text field with an `FID` entry when the files depend on the record. For example, field 123 adds the terms record related to this record, and the signed contract in field 110 only if there is one: ```plaintext [_DBID_TERMS] & ":" & ToText([Related Terms]) & ":7" & If([Signed Contract] > "", ".110", "") ``` Then use `"&addfiles=FID123"` in the button. Exact Forms Plus reads field 123 itself, so you don't need to add it to the clist. - If the `FID` field is the only entry and it's empty, nothing is added. - If it's combined with other entries, for example `addfiles=109.FID123`, it must not be empty: an empty value stops the run with *ERROR - Get Additional Files*. ## Add files to the end of a merged document When a button creates documents for many records (`msqry` or `msqid`) and merges them (`mrgdbid`, `mrgrid`, `mrgfa`), `mrgfiles` adds files once, at the end of the merged PDF. For example, a summary sheet after all the invoices. - A plain field ID in `mrgfiles` refers to the record that gets the merged file (`mrgdbid` and `mrgrid`), not to the records being processed. - `table ID:Record ID#:field ID` and `S3|` entries work as in the table above. `RID` and `FID` don't. - `prefiles` and `addfiles` still apply to each document inside the merged PDF. ```plaintext & "&msqry={'6'.EX.'" & [Record ID#] & "'}" & "&mrgdbid=" & Dbid() &"&mrgrid=" & [Record ID#] &"&mrgfa=20" & "&mrgfn=All Invoices" & "&mrgfiles=21" ``` For the other merge parameters, see [Formula URL parameters](https://help.quickbase.com/quickbase-extensions/docs/en/efp-formula-url-parameters#merged-document). ## Things to know - **Order.** Files go in the order you list them: all `prefiles`, then the document, then all `addfiles`. - **Empty or missing files are skipped.** If a file attachment field is empty, or a file isn't a PDF, that entry is left out and the rest of the document is still created. Check the result if pages seem to be missing. - **Passwords.** Don't combine `prefiles` or `addfiles` with `docpw` or `docpwo`. With `docpw`, the run fails. With `docpwo`, the combined PDF isn't protected. - **S3 keys.** Entries are separated by periods, so an S3 key that contains a period, such as `terms.pdf`, doesn't work. Use keys without periods for files you add this way. - **Access.** Files in other tables or apps are read with the user token saved for your account. That token must be able to see them. - **Run time.** Each document with added files takes a few seconds longer to create. ## If something goes wrong | What you see | What to check | | --- | --- | | *Exact Forms Plus Error: Too Many ADDFILES* (or PREFILES, MRGFILES) | The parameter lists more files than your account allows. List fewer files. | | *ERROR - Get Additional Files:* … | An entry is empty or isn't in one of the formats above, often because an `FID` field is empty or there are two periods in a row. Check the parameter and the `FID` field's value for the record. | | *We're sorry but something went wrong! The following error occurred in ADDFILES:* … | One of the PDFs couldn't be read: it's damaged or password protected, or the document itself has a password (`docpw`). Remove the password, or the file. | | The document is created, but an added file is missing | The field was empty, the file isn't a PDF, the field ID is wrong, or the token can't see the file. Check the entry for that record. | | Nothing is added at all | The button doesn't create a PDF (`docfmt=pdf` is missing), or `test=y` is on. | For other errors, see [Troubleshooting](https://help.quickbase.com/quickbase-extensions/docs/en/efp-troubleshooting). ## Exact Forms Plus or PDF Merger? [PDF Merger](https://help.quickbase.com/quickbase-extensions/docs/en/pdf-merger-overview) is a separate Quickbase Extension that also combines files into one PDF. The two work differently: | | Exact Forms Plus (`prefiles`, `addfiles`, `mrgfiles`) | PDF Merger | | --- | --- | --- | | **What it does** | Adds existing PDFs to a document that Exact Forms Plus is creating from a template. | Combines files that already exist. It doesn't create documents from your Quickbase data. | | **When it runs** | As part of the Exact Forms Plus run: when a user selects the button, or in a background run of the Batch Processor. The result can open in the browser right away. | In the background. A Quickbase email notification starts each merge, either automatically or from the **Execute PDF Merger** button. | | **File types** | PDF only. Other files are skipped. | PDF, plus Word, Excel, text, email (.msg, .eml), and image files, which it converts to PDF first. | | **Where the files come from** | A file attachment field on the record or on a record in another table, or Amazon S3 (keys without periods). Not Dropbox. | File attachment fields, or Amazon S3 or Dropbox, with the S3 key or Dropbox file name stored in a field. | | **Choosing the files** | A list in the button. A formula field (`FID…`) can change the list for each record. | A list of specific files, or every file on the records that a query or report returns. | | **Order** | `prefiles`, then the generated document, then `addfiles`. For a merged document, `mrgfiles` go last. | The order you list the files, or the query's sort order. | | **Where the result is saved** | Wherever the button saves the document: a file attachment field, a repository table, or Amazon S3, Dropbox, or Egnyte. | A file attachment field on an existing record, Amazon S3, or Dropbox. | | **Limits** | Your account sets how many files each parameter can list. | Your account sets the maximum number of files and the maximum size of the merged file. | | **Use it when** | You're creating a document and want the same kinds of PDFs around it every time, such as a cover page or terms. | The files already exist, aren't all PDFs, are in Dropbox, or come from many records, for example a package of all of a project's documents. | To combine documents created by several extensions into one package, see Package Builder.