Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 496373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:40:48+00:00 2026-05-13T05:40:48+00:00

I have PDF forms that I want to autopopulate with data from my Django

  • 0

I have PDF forms that I want to autopopulate with data from my Django web application and then offer to the user to download. What python library would let me easily pre-populate PDF forms? These forms are intended to be printed out.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:40:49+00:00Added an answer on May 13, 2026 at 5:40 am

    Reportlab is great if you’re generating very dynamic PDFs and need to programmatically control all of it: data and layout.

    To just fill out forms in existing PDFs, reportlab is overkill and you’ll basically have to rebuild the PDF from scratch in reportlab instead of just taking a PDF with a form that’s already been made.

    PDF forms work with FDF data. I ported a PHP FDF library to Python a while back when I had to do this and released it as fdfgen. I use that to generate an fdf file with the data for the form, then use pdftk to push the fdf into a PDF form and generate the output.

    The whole process works like this:

    1. You (or a designer) design the PDF in Acrobat or whatever and mark the form fields and take note of the field names (I’m not sure exactly how this is done; our designer does this step). Let’s say your form has fields “name” and “telephone”.
    2. Use fdfgen to create a FDF file:

      from fdfgen import forge_fdf
      fields = [('name','John Smith'),('telephone','555-1234')]
      fdf = forge_fdf("",fields,[],[],[])
      fdf_file = open("data.fdf","w")
      fdf_file.write(fdf)
      fdf_file.close()
      
    3. Then you run pdftk to merge and flatten:

      pdftk form.pdf fill_form data.fdf output output.pdf flatten
      

      and a filled out, flattened (meaning that there are no longer editable form fields) pdf will be in output.pdf.

    It’s a bit complicated, and pdftk can be a pain to install (requires a java stack and there are bugs on Ubuntu 9.10 that have to be worked around) but it’s the simplest process I’ve been able to come up with yet and the workflow is convenient (ie, our designers can make all the layout changes to the PDF they want and as long as they don’t change the names of the fields, I can drop the new one in and everything keeps working).

    I apologize for the lack of docs on fdfgen. forge_fdf() is really the only function you should need and it has a docstrings to explain the arguments. I’ve just never quite gotten around to doing more with it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that uses itextsharp to fill PDF form fields. I got
I have a PDF file, which contains data that we need to import into
I have a LiveCycle designed PDF that I want to make its submit button
I have code (in a .ashx-file) that generates a PDF file from a PDF
I am creating an iPad application, in that i have to use different PDF
I have a PDF file that I want to draw in outline form. I
I work on a fairly large ASP .NET Web Forms application that is currently
I have a 2-page PDF that I want to overlay information on (think of
In my ASP.Net application I have a requirement that when a user clicks on
I have 3D CAD model that I want to show on a web page.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.