#forms #pdf

pdf_form_ids

A library for programatically filling out pdf forms

6 releases (breaking)

Uses old Rust 2015

0.6.0 Nov 16, 2019
0.5.1 Nov 16, 2019
0.4.0 Nov 11, 2019
0.3.0 Nov 9, 2019
0.2.0 Nov 9, 2019

#20 in #form

35 downloads per month

MIT license

27KB
529 lines

Fill PDF Forms

A library to programatically identify and fill out PDF forms

This is a fork of pdf_form, adding support to query field IDs.

Example Code

  • Read a PDF and discover the form fields
extern crate pdf_form_ids;
use pdf_form_ids::{Form, FieldType};

// Load the pdf into a form from a path
let form = Form::load("path/to/pdf").unwrap();
// Get all types of the form fields (e.g. Text, Radio, etc) in a Vector
let field_types = form.get_all_types();
// Print the types
for type in field_types {
    println!("{:?}", type);
};

  • Write to the form fields
extern crate pdf_form_ids;
use pdf_form_ids::{Form, FieldState};

// Load the pdf into a form from a path
let mut form = Form::load("path/to/pdf").unwrap();
form.set_text(0, String::from("filling the field"));
form.save("path/to/new/pdf");


lib.rs:

This crate is for filling out PDFs with forms programatically.

Dependencies

~24MB
~170K SLoC