Giter Site home page Giter Site logo

pdf-fdf-generator's Introduction

pdf-fdf-generator

Generate PDF files containing forms, filled with values using FDF files and PDFtk for NodeJS.

I had some problems while building iconv as a sub-dependency, please try:

npm install --unsafe-perm

Test (informal), directly from package root directory:

user@server ~/pdf-fdf-generator $ coffee test/test.coffee

From test.coffee:

fdfpdfGenerateContent = require('../lib/main').generateContent
fdfpdfGenerateFile    = require('../lib/main').generateFile

dataForFile = [
	{ alfa: 1, beta: 11 },
#	{ alfa: 2, beta: 22 },
#	{ alfa: 3, beta: 33 }
]

dataForContent = [
	{ alfa: 1, beta: 11 },
	{ alfa: 2, beta: 22 },
	{ alfa: 3, beta: 33 }
]

fdfpdfGenerateFile "./test/sampleForm.pdf", dataForFile, "./test/sampleFilledForm.pdf", (error, output, filename)->
	console.log "PPFF :: Finished processing file!"
	console.log "PPFF :: error: ", error
	console.log "PPFF :: output: ", output
	console.log "PPFF :: filename: ", filename

fdfpdfGenerateContent "./test/sampleForm.pdf", dataForContent, (output)->
	console.log "PPCC :: Finished processing contents!"
	console.log "PPCC :: output: ", output

console.log "PPCC :: Finished Contents!"

Sample output from above example:

PPCC :: Finished Contents!
[ { data: { alfa: 1, beta: 11 },
    error: null,
    stdout: '',
    stderr: '',
    fdf: 'fdf-2ab38191-c900-7b49-70cb-a4eacc94da5f.fdf',
    pdf: 'pdf-2ab38191-c900-7b49-70cb-a4eacc94da5f.pdf' } ]
PPFF :: Finished processing file!
PPFF :: error:  null
PPFF :: output:  <Buffer 25 50 44 46 2d 31 2e 34 0a 25 e2 e3 cf d3 0a 36 20 30 20 6f 62 6a 20 0a 3c 3c 0a 2f 46 69 6c 74 65 72 20 2f 46 6c 61 74 65 44 65 63 6f 64 65 0a 2f 4c 65 ...>
PPFF :: filename:  papas.pdf
[ { data: { alfa: 1, beta: 11 },
    error: null,
    stdout: '',
    stderr: '',
    fdf: 'fdf-48a90ab2-a366-5d69-1820-a143cb0b4572.fdf',
    pdf: 'pdf-48a90ab2-a366-5d69-1820-a143cb0b4572.pdf' },
  { data: { alfa: 2, beta: 22 },
    error: null,
    stdout: '',
    stderr: '',
    fdf: 'fdf-850c907e-3326-cc52-7d81-2a28fe9e73ef.fdf',
    pdf: 'pdf-850c907e-3326-cc52-7d81-2a28fe9e73ef.pdf' },
  { data: { alfa: 3, beta: 33 },
    error: null,
    stdout: '',
    stderr: '',
    fdf: 'fdf-d27c4fc9-fb07-e7fe-e569-0f913f65b365.fdf',
    pdf: 'pdf-d27c4fc9-fb07-e7fe-e569-0f913f65b365.pdf' } ]
PPCC :: Finished processing contents!
PPCC :: output:  <Buffer 25 50 44 46 2d 31 2e 34 0a 25 e2 e3 cf d3 0a 36 20 30 20 6f 62 6a 20 0a 3c 3c 0a 2f 46 69 6c 74 65 72 20 2f 46 6c 61

Regards,

Gabriel Medina.

pdf-fdf-generator's People

Contributors

rhaseven7h avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.