All articles

How to Dynamically Fill PDF Fields (2026): 6 Methods

By Ardalan Foroughi, founder of Filly AI · July 13, 2026

How to Dynamically Fill PDF Fields (2026): 6 Methods

TL;DR

Dynamically filling PDF fields means automatically populating form fields with data from a database, spreadsheet, API, or client profile at runtime, rather than typing values in by hand. There are six main approaches: AI-powered form filling tools like Filly AI, code libraries, REST APIs, low-code platforms like Power Automate, general AI-powered tools, and embedded PDF JavaScript. The right method depends on whether you’re a developer, a business power user, or a professional trying to eliminate repetitive data entry across dozens of identical forms.


Imagine you’re an immigration lawyer who just signed a new client. That client’s name, address, date of birth, and A-number need to go into 15 different USCIS forms. Typing it all by hand is slow, error-prone, and soul-crushing. Now imagine entering that data once and watching it flow into every form automatically.

That’s what it means to dynamically fill PDF fields.

This guide explains the concept in plain terms, walks through every method available (from writing code to using AI), and covers the real-world gotchas that practitioners consistently run into.

Explore AI-powered PDF filling to see this concept in action.

What “Dynamically Fill PDF Fields” Actually Means

To dynamically fill PDF fields is to programmatically or automatically inject data into a PDF’s form fields at runtime. The data comes from an external source (a database, spreadsheet, API response, or saved client profile) and gets mapped to specific fields inside the PDF. The output is a completed document, ready for review, signature, or filing.

The word “dynamically” is doing important work here. It draws a hard line between two approaches:

  • Manual filling: A person opens a PDF, clicks into each field, types values, repeats for the next document.

  • Dynamic filling: Software reads data from a source, matches it to field names in the PDF, and populates everything automatically. One record or a thousand, the process is the same.

The core pipeline looks like this:

Data source → Field name mapping → Automated population → Output PDF

Every method for dynamic PDF filling, whether code-based or no-code, follows this pattern. The differences are in how each step gets executed.

How PDF Form Fields Work (The Basics You Need)

Before you can dynamically fill PDF fields, you need to understand what’s actually inside the PDF that makes filling possible.

AcroForms vs. XFA Forms

This is the single biggest source of confusion in PDF automation, and it comes up in nearly every forum thread on the topic.

AcroForms are the standard interactive form type in PDFs. They’ve been part of the PDF specification since version 1.2. When you open a PDF and see clickable text boxes, checkboxes, dropdown menus, and radio buttons, you’re almost certainly looking at AcroForms. They work in virtually every PDF reader.

XFA forms (XML Forms Architecture) were created by Adobe for its LiveCycle product. They’re XML-based and support more complex layouts, but they only render properly in Adobe Acrobat and Reader. Most third-party PDF libraries and tools offer limited XFA support, or none at all. Adobe itself has been phasing XFA out of modern Acrobat versions.

One developer on a forum described “banging my head against the wall with an XFA form” before convincing the client to re-render it as an AcroForm. That’s a common outcome. If you have a choice, use AcroForms. If you’re stuck with XFA, expect compatibility headaches with most tools.

Field Names: The Critical Bridge

Every interactive field in a PDF has an internal name. When you dynamically fill PDF fields, you’re essentially saying: “Put this value into the field called X.”

The data schema is typically a key-value pair where the key is the field name inside the PDF and the value is what you want to insert. For example:

{
  "first_name": "Maria",
  "last_name": "Santos",
  "date_of_birth": "1985-03-14"
}

The catch? Many PDF templates, especially government forms, have auto-generated field names like “Text269” or “topmostSubform[0].Page1[0].f1_01[0]” instead of readable labels. Practitioners on Reddit frequently cite field naming chaos as one of the most tedious parts of setting up dynamic filling. You often need to extract and map field names before you can fill anything.

Field Types

PDF forms can contain several field types, each with its own quirks for dynamic filling:

  • Text fields: The simplest. Accept string values.

  • Checkboxes: Require the exact “on” value defined in the PDF (often “Yes”, “On”, or “1”, but not always).

  • Radio buttons: Grouped fields where only one can be selected. The value must match one of the predefined options.

  • Dropdowns (combo boxes): Accept a value from the list of defined options.

  • Signature fields: Typically handled separately through digital signature workflows.

A practitioner in a StackOverflow thread reported that checkbox fields with only one radio button choice refused to update via the standard setField() method. These edge cases are more common than documentation suggests.

Flattening: Locking the Data In

After dynamically filling a PDF, many workflows “flatten” the document. Flattening merges the field data into the PDF’s visual layer, making the fields non-editable. The result looks identical, but the form fields are gone, replaced by static text and graphics.

Flattening matters for compliance. Courts, government agencies, and HR departments often require flattened PDFs so that filed documents can’t be altered after submission.

Six Methods to Dynamically Fill PDF Fields

Not every approach fits every user. A solo immigration paralegal has different needs than a software team building a document pipeline. Here’s how each method works, who it’s for, and where it falls short.

Method

Best For

Technical Skill

Batch Support

Handles Scanned PDFs?

Filly AI

Lawyers, HR, accountants, freelancers

Low

Yes (up to 20 clients)

Yes (OCR + AI)

Code libraries

Developers building custom pipelines

High

Yes (custom)

No (need OCR first)

REST APIs

Dev teams integrating fill into apps

Medium-High

Yes (via API calls)

Varies by provider

Low-code platforms

Business users in Microsoft/Google ecosystems

Low-Medium

Limited

No

AI-powered tools (general)

Non-technical professionals

Low

Yes

Yes (via OCR/AI)

Embedded PDF JavaScript

Legacy/niche cases

Medium

No

No

1. Filly AI (AI-Powered Form Filling from Client Profiles)

Filly AI takes a profile-first approach to dynamic PDF filling. Instead of mapping fields manually or writing code, you upload any PDF or Word document (including scanned forms), and the tool’s AI detects the fields automatically via OCR and field extraction. You create reusable client profiles with all relevant data, and Filly AI maps that data to detected fields using confidence-coded autofill, color-coding each match so you can quickly spot and correct low-confidence fills before exporting.

The standout capability is batch filling: select a template, choose up to 20 clients, and generate a separate completed PDF for each in a single run. Output is pixel-perfect, overlaying filled data onto the original document image so that court filings, government submissions, and compliance records retain their exact official layout.

Filly AI also includes no-login share and e-signature links, letting clients review and sign without creating accounts. Security features include encryption in transit and at rest, row-level data isolation, GDPR-aligned deletion controls, and a published list of sub-processors. A free plan (3 forms, 5 clients, 10 fills per month) is available with no credit card required, and paid plans start at $19/month.

When to choose this: You’re a lawyer, HR professional, accountant, or freelancer who fills the same types of forms repeatedly, wants AI to handle field detection and data mapping, and needs batch filling or e-signatures without any technical setup.

2. Code Libraries (Developer Approach)

Libraries like iText (Java/C#), Apache PDFBox (Java), pdf-lib (JavaScript), and PyPDF2 (Python) give developers full programmatic control over PDF filling. The typical pattern is: open the PDF, get a field by name using something like getField(), set the value with setValue(), and save the output.

This approach is the most flexible. You can integrate it into any application, connect to any database, and handle complex logic. The tradeoff is that you need to write and maintain code. You also need to handle field name extraction, font embedding, and encoding issues yourself.

When to choose this: You’re building a product or internal tool that generates filled PDFs at scale, and you have developers on the team.

3. REST APIs (SaaS Developer Approach)

Services like pdfRest, CraftMyPDF, and DocSpring offer hosted APIs. You send a PDF (as a URL or base64 string) along with key-value pairs matching the field names, and you receive a fully populated PDF in return.

This removes the burden of managing PDF libraries directly. You still need a developer to integrate the API, but the heavy lifting of parsing, filling, and rendering happens server-side.

When to choose this: You want programmatic PDF filling without managing PDF libraries in your own infrastructure.

4. Low-Code Platforms (Power Automate, Zapier)

This is a huge segment of the audience. Practitioners on Reddit and Microsoft community forums frequently ask about filling PDFs from SharePoint lists, Excel spreadsheets, or Dynamics 365 records using Power Automate.

Here’s the problem: Microsoft Power Automate does not include a native PDF fill action. You need third-party connectors like Encodian, Plumsail, or PDF.co to bridge the gap. One user on the Adobe Community forum noted, “I’m looking at the Adobe PDF Services APIs but I don’t see populating/filling dynamic PDFs on the list, so I’m hesitant to look further.” That frustration is widespread.

The workflow typically looks like this: a trigger fires (new row in SharePoint, form submission, scheduled time), the connector receives the PDF template and a JSON object of field values, and it returns the filled PDF to a folder, email, or approval flow.

A practitioner blogger documented his Power Automate Desktop setup and reported it was 5x faster than manual entry for generating Power of Attorney documents from a SharePoint list.

When to choose this: You’re a business user comfortable with Power Automate or Zapier and want to connect a data source to a PDF template without writing code.

If you need to compare PDF filling tools across these categories, that comparison can help narrow your options.

5. AI-Powered Tools (General Category)

This is the newest category and the fastest-growing one. AI-powered tools let you upload any PDF (including scanned documents), automatically detect the fields, and fill them from saved data profiles.

The biggest advancement is AI field detection. Upload a document, even a scanned image or Word file, and modern tools automatically identify where the fields are. Some achieve 95%+ accuracy on standard forms according to recent tools reviews. This eliminates the manual field-mapping step that makes other approaches tedious.

Tools in this category use reusable client profiles as the data source. You enter a client’s information once, and the tool maps that data to fields across any form you upload. Confidence-coded autofill flags uncertain matches for review, and pixel-perfect PDF output overlays filled data onto the original document.

One user on Indie Hackers captured the gap this category fills: “I am trying to find a way of filling up a visa application form which is in the PDF format using no-code tools. I know it is possible. I just don’t know how specifically.”

When to choose this: You’re a professional who fills the same types of forms repeatedly and doesn’t want to write code or configure Power Automate flows.

See pricing and plan details to evaluate whether this approach fits your volume.

6. Embedded PDF JavaScript

Acrobat JavaScript can be embedded directly inside a PDF to pull data from external files or URLs and populate fields on open. This is an older technique referenced in forum threads going back to the early 2000s.

It still works in Adobe Acrobat, but modern PDF readers have tightened security restrictions significantly. Most non-Adobe viewers ignore embedded JavaScript entirely. This approach is only viable for controlled environments where you know every user has full Acrobat.

When to choose this: Almost never, unless you’re maintaining a legacy system.

The Scanned and Flat PDF Challenge

Here’s the reality that most guides skip over: many real-world PDFs don’t have interactive form fields at all.

Government forms from courts and agencies, legacy contracts, and scanned documents are often “flat” PDFs, just images of text with no fillable fields underneath. Standard dynamic filling techniques can’t touch them.

Practitioners on forums describe this problem regularly. One developer explained their project starts “with government-approved PDF documents that do not contain forms,” requiring conversion before any filling can happen.

There are two paths forward:

OCR (Optical Character Recognition) converts scanned images into machine-readable text. This is the prerequisite step for any automated processing of flat PDFs. But OCR has limits. It can misread characters in low-quality scans, struggle with tables, and fail on handwriting or stamps.

AI field detection goes further. Instead of just reading text, it identifies where form fields should be based on the document’s visual layout, labels, and context. This approach can turn a flat PDF into a fillable one without manual field creation.

Why Pixel-Perfect Output Matters

When you dynamically fill PDF fields destined for court filings, government submissions, or compliance records, the output must match the original template exactly. Courts have rejected filings where the layout shifted, fonts changed, or field borders disappeared. Pixel-perfect filling, where data is overlaid onto the original document image rather than injected into reconstructed fields, avoids these problems.

Common Pitfalls When You Dynamically Fill PDF Fields

These are the issues that eat hours and generate frustrated forum posts. Knowing them in advance saves real time.

Mismatched Field Names

PDF templates, especially government ones, often have cryptic auto-generated names like “Text269” or “topmostSubform[0].Page2[0].Line3a[0]”. You need to extract the full field name list before mapping your data. Many tools and libraries provide a “list all fields” function for this purpose, but the mapping itself is manual and tedious for complex forms.

XFA Compatibility Problems

If your PDF uses XFA forms, most non-Adobe tools will either fail silently or produce corrupted output. Always check the form type before choosing your approach. Many connectors and libraries note that while they support both XFA and AcroForms, they provide “greater support for changing data within AcroForms.”

Checkbox and Radio Button Mismatches

Setting a checkbox to “true” won’t work if the PDF expects the value “Yes” or “1” or “X”. Each checkbox has its own defined on-value, and you need to match it exactly. Radio button groups are worse, because the group name and individual option values are often different from what the visible label shows.

Font Embedding and Field Overflow

If your filled text exceeds the field’s defined size, it may get clipped, overflow, or shrink to an unreadable font size. Non-Latin characters can disappear entirely if the PDF doesn’t embed the right fonts. Always test with real data, not just short sample values.

Security Restrictions

Password-protected PDFs or those with restricted permissions may block programmatic field modification. Some PDFs allow filling but prohibit printing or extraction, which creates problems downstream.

When handling sensitive client data across any of these methods, understand what security and data handling practices your chosen tool follows, especially for PII like Social Security numbers, immigration case details, or financial records.

Who Uses Dynamic PDF Filling (and Why)

Immigration Lawyers

Immigration law is arguably the highest-volume PDF filling use case. A single client may require data entry across 15 or more USCIS, DOL, and DOS forms. Platforms built for this space provide access to 300+ immigration forms that auto-populate from one data entry. For firms using more general tools, the ability to save a client profile once and fill across official government forms is a major time saver.

HR Teams

Every new hire generates a stack of paperwork: I-9 forms, W-4 forms, offer letters, benefits enrollment, and more. When you’re onboarding a cohort of 20 people, batch filling from a spreadsheet or profile database eliminates days of manual work. You can explore batch filling PDFs from Excel for a walkthrough of that workflow.

Accountants and Tax Preparers

W-9 forms, engagement letters, and tax organizers share overlapping client data. Dynamic filling from client profiles means entering a taxpayer’s EIN, address, and entity type once rather than across every document.

Freelancers and Consultants

Invoices, NDAs, service agreements, and project proposals all draw from the same pool of client and project data. For solo operators, even saving 15 minutes per document adds up to hours each week. Browse ready-to-use templates for common documents like invoices, contractor agreements, and statements of work.

Government Agencies

Agencies generating compliance forms at scale, whether for benefits administration, permitting, or regulatory filings, were among the earliest adopters of dynamic PDF filling through code-based approaches.

Batch Filling: The Overlooked Capability

Most guides about dynamically filling PDF fields focus on filling one document at a time. But the real productivity gain for many professionals is batch filling: taking one template and generating completed versions for multiple clients or records in a single run.

Consider an HR department onboarding 15 new hires. Without batch filling, someone opens the offer letter template, types in employee 1’s details, saves, reopens, types employee 2’s details, and repeats 15 times. With batch filling, you point the tool at your employee list and get 15 completed offer letters in one operation.

This capability is available through code (loop through records and fill iteratively), some APIs (multiple calls), and select AI tools that support multi-client batch runs natively. It’s the difference between automating one form and automating an entire workflow.

Choosing the Right Approach

The best method depends on three factors:

  1. Your technical skill level. Developers should consider code libraries or APIs. Business users should look at Power Automate with connectors. Professionals who want zero setup should start with AI tools like Filly AI.

  2. Your PDF types. If your PDFs already have interactive AcroForm fields, any method works. If you’re working with scanned or flat PDFs, you need OCR or AI field detection.

  3. Your volume. Filling one PDF a week doesn’t justify a code-based pipeline. Filling hundreds per month does. Batch support becomes essential at scale.

Productivity losses from manual document processes can reach 20 to 30% of annual revenue according to document processing research. Even modest automation pays for itself quickly.

If you’re ready to stop manually retyping client data into PDFs, try Filly AI’s free plan to see how AI-powered dynamic filling works on your actual forms.

Frequently Asked Questions

What does “dynamically fill PDF fields” mean?

It means automatically populating a PDF’s form fields with data from an external source (database, spreadsheet, API, or client profile) at runtime, rather than manually typing into each field. The word “dynamically” indicates the process happens programmatically based on data, not through manual interaction.

Can I dynamically fill a scanned PDF that doesn’t have form fields?

Not directly. Scanned or “flat” PDFs are essentially images and contain no interactive fields. You first need OCR to recognize the text, then either manually create form fields or use AI field detection to identify where fields should exist. Only after that step can you fill them dynamically.

What’s the difference between AcroForms and XFA forms?

AcroForms are the standard interactive form type supported by virtually all PDF readers and libraries. XFA forms were created by Adobe for its LiveCycle product and use XML under the hood. XFA forms only render properly in Adobe Acrobat and are increasingly unsupported by third-party tools. If you have the choice, use AcroForms.

Do I need to know how to code to dynamically fill PDF fields?

No. Low-code platforms like Power Automate (with connectors like Encodian or Plumsail) and AI-powered tools like Filly AI allow you to fill PDFs without writing any code. Code libraries and APIs are available for developers who want more control, but they’re not the only option.

How do I find the field names inside a PDF?

Most PDF libraries include a function to list all form fields and their names. In Adobe Acrobat, you can view field names in the “Prepare Form” tool. Many API services and AI tools also extract and display field names automatically when you upload a PDF.

What data format do I need to dynamically fill PDF fields?

JSON is the most common format for programmatic filling, structured as key-value pairs where keys match field names. XFDF (an XML-based format) is used in workflows requiring standardized form data exchange. Some tools accept CSV or Excel files for batch operations.

What is PDF flattening, and when should I use it?

Flattening merges filled field data into the PDF’s visual layer, making fields permanently non-editable. Use it when submitting documents for filing, compliance, or legal purposes where the content must not be alterable after completion.

Can I fill the same PDF template for multiple clients at once?

Yes, this is called batch filling. Code-based approaches handle it through loops. Some AI tools support it natively. For example, Filly AI allows batch filling for up to 20 clients in a single run, generating a separate completed PDF for each.

Fill any form in seconds

Try Filly AI free — no credit card required.

Get started

We use optional analytics and advertising-measurement cookies to understand product usage and see which ads bring people to Filly. You can accept them, or continue with essential-only. Privacy policy.