Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
node-pdffiller
Advanced tools
Take an existing PDF Form and data and PDF Filler will create a new PDF with all given fields populated.
A node.js PDF form field data filler and FDF generator toolkit. This essentially is a wrapper around the PDF Toolkit library PDF ToolKit.
First, run npm install node-pdffiller --save
for your app. Then, in an Express app:
var pdfFiller = require('node-pdffiller');
// ...
##Examples
var pdfFiller = require( 'node-pdffiller' );
var sourcePDF = "test/test.pdf";
var destinationPDF = "test/test_complete.pdf";
var data = {
"last_name" : "John",
"first_name" : "Doe",
"date" : "Jan 1, 2013",
"football" : "Off",
"baseball" : "Yes",
"basketball" : "Off",
"hockey" : "Yes",
"nascar" : "Off"
};
pdfFiller.fillForm( sourcePDF, destinationPDF, data, function(err) {
if (err) throw err;
console.log("In callback (we're done).");
});
This will take the test.pdf, fill the fields with the data values and create a complete filled in PDF (test_filled_in.pdf)
var pdfFiller = require( 'node-pdffiller' );
var sourcePDF = "test/test.pdf";
var FDF_data = pdfFiller.generateFDFTemplate( sourcePDF, function(err, fdfData) {
if (err) throw err;
console.log(fdfData);
});
This will print out this
"last_name" : "",
"first_name" : "",
"date" : "",
"football" : "",
"baseball" : "",
"basketball" : "",
"hockey" : "",
"nascar" : ""
};```
#### 3. Map form fields to PDF fields
````javascript
var pdfFiller = require( 'node-pdffiller' ),
sourcePDF = "test/test.pdf",
FDF_data,
destinationPDF = "test/test_complete.pdf";
var conversionMap = {
"lastName": "last_name",
"firstName": "first_name",
"Date": "date",
"lastName": "last_name",
"footballField": "football",
"bballField": "basketball",
"baseballField": "baseball",
"hockeyField": "hockey",
"nascarField": "nascar"
};
var FormFields = {
"lastName" : "John",
"firstName" : "Doe",
"Date" : "Jan 1, 2013",
"footballField" : "Off",
"baseballField" : "Yes",
"bballField" : "Off",
"hockeyField" : "Yes",
"nascarField" : "Off"
};
pdfFiller.mapForm2PDF( data, convMap, function(err, mappedFields) {
if (err) throw err;
console.log(mappedFields);
});
This will print out the object below.
"last_name" : "John",
"first_name" : "Doe",
"date" : "Jan 1, 2013",
"football" : "Off",
"baseball" : "Yes",
"basketball" : "Off",
"hockey" : "Yes",
"nascar" : "Off"
};```
#### 4. Convert fieldJson to FDF data
````javascript
var pdfFiller = require( 'node-pdffiller' );
var sourcePDF = "test/test.pdf";
var fieldJson = [
{
"title" : "last_name",
"fieldfieldType": "Text",
"fieldValue": "Doe"
},
{
"title" : "first_name",
"fieldfieldType": "Text",
"fieldValue": "John"
},
{
"title" : "date",
"fieldType": "Text",
"fieldValue": "Jan 1, 2013"
},
{
"title" : "football",
"fieldType": "Button",
"fieldValue": false
},
{
"title" : "baseball",
"fieldType": "Button",
"fieldValue": true
},
{
"title" : "basketball",
"fieldType": "Button"
"fieldValue": false
},
{
"title" : "hockey",
"fieldType": "Button"
"fieldValue": true
},
{
"title" : "nascar",
"fieldType": "Button"
"fieldValue": false
}
];
var FDFData = pdfFiller.convFieldJson2FDF( data );
console.log(FDFData)
This will print out this
{
"last_name" : "John",
"first_name" : "Doe",
"date" : "Jan 1, 2013",
"football" : "Off",
"baseball" : "Yes",
"basketball" : "Off",
"hockey" : "Yes",
"nascar" : "Off"
};
FAQs
Take an existing PDF Form and data and PDF Filler will create a new PDF with all given fields populated.
We found that node-pdffiller demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.