Skip to content

How to Add Dynamic Images to Merged PDFs

Insert dynamic images into merged PDFs. Upload images to Media Albums, map filenames to spreadsheet data, and generate PDFs with personalized images.

Adding Dynamic Images to Your Merged PDFs

Static PDFs are fine for plain text, but many documents need personalized images — employee photos on ID badges, product images on invoices, company logos on letters, or student photos on certificates. Mergram’s image fields let you embed different images into each merged PDF based on your spreadsheet data.

Prerequisites

To use image fields in your merged PDFs, you need:

PNG and JPEG only

Mergram embeds images using the PDF standard, which supports PNG and JPEG natively. Other formats (WebP, BMP, TIFF, GIF, SVG) are not supported. Convert your images before uploading for reliable results.

How Image Fields Work

The image field workflow connects your spreadsheet data to a library of uploaded images:

  1. Upload images to a Media Album (team-scoped storage)
  2. Name your images with filenames that match your spreadsheet values
  3. Place an image field on the canvas tied to a spreadsheet column
  4. Merge — for each row, Mergram looks up the cell value, finds the matching image, and embeds it

This means the spreadsheet acts as the “lookup key” — each cell tells Mergram which image to use for that row.

Setting Up Media Albums

Media Albums organize your images into named collections. Each album belongs to your team and can be linked to templates.

Creating an Album

  1. Go to Assets → Media Albums
  2. Click Create Album and give it a descriptive name (e.g., “Employee Photos”, “Product Images”)
  3. Upload your images (PNG or JPEG, up to 10MB each)

Naming Convention Best Practices

Your image filenames must match the values in your spreadsheet. Here are recommended naming patterns:

PatternFilename ExampleSpreadsheet ValueNotes
By person namealice-chen.jpgalice-chenCase-insensitive match
By IDEMP001.pngEMP001Reliable, avoids name conflicts
By product codeSKU-12345.jpgSKU-12345Good for product catalogs
By filenamephoto.jpgphoto.jpgFull filename with extension

Stem fallback matching

Mergram matches cell values against image filenames using case-insensitive comparison with stem fallback. This means a cell value of ‘alice’ matches an uploaded file named ‘alice.jpg’, ‘alice.png’, or ‘alice.PNG’. You don’t need to include the file extension in your spreadsheet — but you can if you prefer.


Placing Image Fields on the Canvas

Step 1: Select the Image Column

In the editor sidebar, find the column that contains your image filenames (e.g., “Photo”, “Logo”, “ProductImage”).

Step 2: Set Render Type to Image

Drag the column onto the canvas. Change the render type from “Text” to “Image”. A bounding box appears that represents where the image will be placed.

Step 3: Resize and Position

Adjust the bounding box to control the image dimensions and placement:

Real-World Examples

Employee ID Badges

Spreadsheet ColumnExample ValuePurpose
FirstNameAliceName on badge
LastNameChenName on badge
DepartmentEngineeringDepartment label
EmployeeIDEMP001ID number
Photoalice-chenImage field — matches alice-chen.jpg in album

Place the Photo field as an Image type at the top of the badge.

Product Invoices with Images

Spreadsheet ColumnExample ValuePurpose
ClientNameAcme CorpInvoice header
Amount$1,250.00Invoice total
ProductCodeSKU-12345Product reference
ProductImageSKU-12345Image field — matches SKU-12345.jpg

Place ProductImage as an Image type next to the product description.

Certificates with Signatures

Upload signature images (scanned signatures as transparent PNGs) to an album. Map a “Signature” column to place the correct signer’s signature on each certificate.


Best Practices for Image Fields

  1. Resize images before uploading — A 4000px photo displayed at 200px wastes storage and slows processing. Resize to roughly the display dimensions.
  2. Use consistent filenames — Decide on a naming convention and stick to it. Mixing patterns (some with extensions, some without) causes missed matches.
  3. Test with 5–10 rows first — Upload a few images, match them to sample rows, and preview before uploading your entire image library.
  4. Use PNG for transparency — Logos and signatures with transparent backgrounds should be PNG. JPEG does not support transparency.
  5. Keep file sizes reasonable — Aim for under 1MB per image. Large images slow down both preview and bulk merge processing.

Common Issues and Troubleshooting

Images not appearing in merged PDFs: Check that your Media Album is linked to the template (via the Media tab in the editor sidebar). Also verify that the spreadsheet values exactly match the uploaded filenames — extra spaces, different extensions, or case differences can cause mismatches.

Wrong image for a row: The matching is based on the cell value and filename. If two images have similar names (e.g., photo1.jpg and photo10.jpg), make sure the cell value is specific enough to match only the intended file.

Upload fails with large images: The per-file limit is 10MB. Resize your images to a reasonable resolution (300 DPI at print size is plenty) and re-upload.

Get Started

Create a Media Album, upload your images, and start placing image fields in the Mergram editor. Preview with real data to see your dynamic images rendered live before running the full merge.

Step-by-step guide

  1. 1

    Create a Media Album

    Go to Assets → Media Albums and create an album for your images. Upload all images (PNG/JPEG) to this album.

  2. 2

    Prepare Spreadsheet

    Add a column with image filenames that match your uploaded files. Each row's value corresponds to the image for that PDF.

  3. 3

    Place Image Field

    In the editor, drag the image column onto the canvas and set the render type to 'Image'. Resize the bounding box.

  4. 4

    Link Album

    Connect your Media Album to the template in the Media tab of the editor sidebar.

  5. 5

    Preview and Merge

    Preview to verify images load correctly, then run the merge to generate PDFs with dynamic images.

Frequently asked questions

What image formats are supported?
Mergram supports PNG and JPEG images only. These are the formats compatible with PDF embedding. If you have images in other formats like WebP, BMP, or TIFF, convert them to PNG or JPEG before uploading.
How does Mergram match images to spreadsheet data?
Mergram matches the value in your spreadsheet cell against the filenames of images in your Media Album. Matching is case-insensitive and includes stem fallback — 'photo.jpg' matches 'photo' in the cell. Ensure your filenames and spreadsheet values align for reliable matching.
What is the maximum image file size?
Individual image uploads are limited to 10MB. For best performance, resize images to approximately the dimensions they'll appear in the PDF before uploading — there's no benefit to uploading a 4000px image for a 200px field.
What happens if no matching image is found?
If a spreadsheet value doesn't match any image in the album, the field is skipped for that row and a warning is logged. The merge continues without failing — the remaining fields and rows are processed normally.
Can I use different images for each row?
Yes. Each row's cell value is matched independently against the Media Album. If row 1 has 'alice.jpg' and row 2 has 'bob.jpg', each PDF gets the corresponding image — as long as both files are uploaded to the album.

Ready to try it yourself?

Start merging PDFs in minutes — free account required, no credit card needed.

Related articles