Crates.io | pdf_forms |
lib.rs | pdf_forms |
version | 0.3.4 |
source | src |
created_at | 2020-09-23 22:41:27.555342 |
updated_at | 2020-10-03 18:12:45.166224 |
description | A library for programatically filling out pdf forms |
homepage | |
repository | https://github.com/Emulator000/pdf_form |
max_upload_size | |
id | 292296 |
size | 35,574 |
A library to programatically identify and fill out PDF forms.
WARNING: This is a fork of the original "pdf_form" crate made by jsandler18, including all improvements made by malte-v.
Read a PDF and discover the form fields
extern crate pdf_form;
use pdf_form::{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;
use pdf_form::{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");