aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake Sandler2021-03-03 06:59:49 -0500
committerGitHub2021-03-03 06:59:49 -0500
commitf3ba74748fa189179609f43949506455bcc06f75 (patch)
tree133c1af937674eb2ed69159147f62b2998698c08
parent3d42dcdc89ddf4b4982fecc64e5cd8eb94bb9026 (diff)
parent7ab1a677dd7b42ff79fafca5af31a2d3c8882dae (diff)
downloadpdf_form-master.tar.bz2
Merge pull request #9 from florian-str/masterHEADmaster
Fixed the code sample
-rw-r--r--README.md32
1 files changed, 16 insertions, 16 deletions
diff --git a/README.md b/README.md
index 02b1474..85f9795 100644
--- a/README.md
+++ b/README.md
@@ -6,26 +6,26 @@ A library to programatically identify and fill out PDF forms
```rust
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);
-};
-
+fn main(){
+ // 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 field_type in field_types {
+ println!("{:?}", field_type);
+ };
+}
```
* Write to the form fields
```rust
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");
-
+fn main(){
+ // 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");
+}
```