#forms #pdf

pdf_form_ids

一个用于程序化填写 PDF 表格的库

6 个版本 (破坏性更新)

使用旧 Rust 2015

0.6.0 2019 年 11 月 16 日
0.5.1 2019 年 11 月 16 日
0.4.0 2019 年 11 月 11 日
0.3.0 2019 年 11 月 9 日
0.2.0 2019 年 11 月 9 日

#14 in #form

MIT 许可证

27KB
529

填写 PDF 表格

一个用于程序化识别和填写 PDF 表格的库

这是 pdf_form 的分支,增加了查询字段 ID 的支持。

示例代码

  • 读取 PDF 并发现表单字段
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);
};

  • 写入表单字段
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:

本包用于程序化填写 PDF 表格。

依赖关系

~24MB
~168K SLoC