Skip to content

Commit

Permalink
Version 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
John Taylor committed Oct 7, 2016
1 parent 90797d1 commit 1719d79
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Binary file removed .DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License (MIT)

Copyright (c) 2014-2015 John Taylor
Copyright (c) 2014-2016 John Taylor

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pdffiller",
"version": "0.0.7",
"version": "0.0.8",
"private": false,
"description": "Take an existing PDF Form and data and PDF Filler will create a new PDF with all given fields populated.",
"main": "index.js",
Expand All @@ -25,7 +25,7 @@
"readmeFilename": "README.md",
"gitHead": "dc344fd81d90d0434dcc253d9ee14e4328b680dd",
"readme": "PDF Filler (Node.js)\n======\n\nA node.js PDF form field data filler and FDF generator toolkit. This essentially is a wrapper around the PDF Toolkit library <a target=\"_blank\" href=\"http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/\">PDF ToolKit</a>.\n\nPDF Filler requires the PDF ToolKit which can be found here: <a target=\"_blank\" href=\"http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/\">PDF ToolKit</a>\n\n\n##Examples\n\n#### 1.Fill PDF with existing FDF Data\n````javascript\nvar pdfFiller = require( 'pdffiller' );\n\nvar sourcePDF = \"test/test.pdf\";\nvar destinationPDF = \"test/test_complete.pdf\";\n\nvar data = {\n \"last_name\" : \"John\",\n \"first_name\" : \"Doe\",\n \"date\" : \"Jan 1, 2013\",\n \"football\" : \"Off\",\n \"baseball\" : \"Yes\",\n \"basketball\" : \"Off\",\n \"hockey\" : \"Yes\",\n \"nascar\" : \"Off\"\n};\n\npdfFiller.fillForm( sourcePDF, destinationPDF, data, function(err) { \n if (err) throw err;\n console.log(\"In callback (we're done).\"); \n});\n\n````\n\nThis will take the test.pdf, fill the fields with the data values\nand create a complete filled in PDF (test_filled_in.pdf)\n\n\n#### 2. Generate FDF Template from PDF\n````javascript\nvar pdfFiller = require( 'pdffiller' );\n\nvar sourcePDF = \"test/test.pdf\";\n\nvar FDF_data = pdfFiller.generateFDFTemplate( sourcePDF, function(err, fdfData) { \n if (err) throw err;\n console.log(fdfData);\n});\n\n````\n\nThis will print out this \n```{\n \"last_name\" : \"\",\n \"first_name\" : \"\",\n \"date\" : \"\",\n \"football\" : \"\",\n \"baseball\" : \"\",\n \"basketball\" : \"\",\n \"hockey\" : \"\",\n \"nascar\" : \"\"\n};```\n\n#### 3. Generate FDF Template from PDF\n````javascript\nvar pdfFiller = require( 'pdffiller' );\n\nvar sourcePDF = \"test/test.pdf\";\n\nvar FDF_data = pdfFiller.generateFDFTemplate( sourcePDF, function(err, fdfData) { \n if (err) throw err;\n console.log(fdfData);\n});\n\n````\n\nThis will print out this \n```\n{\n \"last_name\" : \"\",\n \"first_name\" : \"\",\n \"date\" : \"\",\n \"football\" : \"\",\n \"baseball\" : \"\",\n \"basketball\" : \"\",\n \"hockey\" : \"\",\n \"nascar\" : \"\"\n};\n```\n\n#### 4. Map form fields to PDF fields\n````javascript\nvar pdfFiller = require( 'pdffiller' ),\n sourcePDF = \"test/test.pdf\",\n FDF_data,\n destinationPDF = \"test/test_complete.pdf\";\n\nvar conversionMap = {\n \"lastName\": \"last_name\",\n \"firstName\": \"first_name\",\n \"Date\": \"date\",\n \"lastName\": \"last_name\",\n \"footballField\": \"football\",\n \"bballField\": \"basketball\",\n \"baseballField\": \"baseball\",\n \"hockeyField\": \"hockey\",\n \"nascarField\": \"nascar\"\n};\n\nvar FormFields = {\n \"lastName\" : \"John\",\n \"firstName\" : \"Doe\",\n \"Date\" : \"Jan 1, 2013\",\n \"footballField\" : \"Off\",\n \"baseballField\" : \"Yes\",\n \"bballField\" : \"Off\",\n \"hockeyField\" : \"Yes\",\n \"nascarField\" : \"Off\"\n};\n\npdfFiller.mapForm2PDF( data, convMap, function(err, mappedFields) { \n if (err) throw err;\n\n console.log(mappedFields);\n});\n````\n\nThis will print out the object below.\n```{\n \"last_name\" : \"John\",\n \"first_name\" : \"Doe\",\n \"date\" : \"Jan 1, 2013\",\n \"football\" : \"Off\",\n \"baseball\" : \"Yes\",\n \"basketball\" : \"Off\",\n \"hockey\" : \"Yes\",\n \"nascar\" : \"Off\"\n};```\n\n#### 5. Convert fieldJson to FDF data\n````javascript\nvar pdfFiller = require( 'pdffiller' );\n\nvar sourcePDF = \"test/test.pdf\";\nvar fieldJson = [\n {\n \"title\" : \"last_name\",\n \"fieldfieldType\": \"Text\",\n \"fieldValue\": \"Doe\"\n },\n {\n \"title\" : \"first_name\",\n \"fieldfieldType\": \"Text\",\n \"fieldValue\": \"John\"\n },\n {\n \"title\" : \"date\",\n \"fieldType\": \"Text\",\n \"fieldValue\": \"Jan 1, 2013\"\n },\n {\n \"title\" : \"football\",\n \"fieldType\": \"Button\",\n \"fieldValue\": false\n },\n {\n \"title\" : \"baseball\",\n \"fieldType\": \"Button\",\n \"fieldValue\": true\n },\n {\n \"title\" : \"basketball\",\n \"fieldType\": \"Button\"\n \"fieldValue\": false\n },\n {\n \"title\" : \"hockey\",\n \"fieldType\": \"Button\"\n \"fieldValue\": true\n },\n {\n \"title\" : \"nascar\",\n \"fieldType\": \"Button\"\n \"fieldValue\": false\n }\n];\n\nvar FDFData = pdfFiller.convFieldJson2FDF( data );\nconsole.log(FDFData)\n````\n\nThis will print out this \n````\n{\n \"last_name\" : \"John\",\n \"first_name\" : \"Doe\",\n \"date\" : \"Jan 1, 2013\",\n \"football\" : \"Off\",\n \"baseball\" : \"Yes\",\n \"basketball\" : \"Off\",\n \"hockey\" : \"Yes\",\n \"nascar\" : \"Off\"\n};\n````\n",
"_id": "[email protected].5",
"_id": "[email protected].8",
"_shasum": "416c724b748a5e0caf494fb66b043d450b8a3b9a",
"_from": "whitef0x0/pdffiller",
"_resolved": "git://github.com/whitef0x0/pdffiller.git#dc344fd81d90d0434dcc253d9ee14e4328b680dd",
Expand Down

0 comments on commit 1719d79

Please sign in to comment.