pdffillerjs / pdffiller

Take an existing PDF Form and data and PDF Filler will create a new PDF with all given fields populated.
MIT License
286 stars 113 forks source link

ReferenceError: convFieldJson2FDF is not defined #45

Closed hmtri1011 closed 7 years ago

hmtri1011 commented 7 years ago

I had this error when using the Generate FDF Template from PDF example.

Then I saw your latest commit in index.js so I removed this line (line 100) return callback(null, convFieldJson2FDF(_form_fields));

and replace it with your previous code

var _keys = _.pluck(_form_fields, 'title'), _values = _.pluck(_form_fields, 'fieldValue'), jsonObj = _.zipObject(_keys, _values); return callback(null, jsonObj);

It worked again. Please check it!

Edit 1 : I used todust 's code on pull request and it worked! Edit 2 : mapForm2PDF example does not work for me my code :

const mapTest = {
    "name": "First Name"
}

const userObject = {
    "name": "MTae"
};

pdfFiller.mapForm2PDF(userObject, mapTest, function (err, mappedFields) {
    if (err) throw err;
    console.log(mappedFields);
});

But it does not show anything

johntayl commented 7 years ago

Fixed in pull request #44

Published to npm v0.0.10