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

ng serve Errors: Module not found: Error: Can't resolve 'child_process' #68

Open nabgilby opened 6 years ago

nabgilby commented 6 years ago

ISSUE: I can't do a simple run/build with Angular 5. I spent many hours trying many things but nada

VERSIONS: node@v8.9.4 npm@5.7.1 @angular/cli@1.7.3

STEPS TO RECREATE:

  1. ng new testFill

  2. cd test

  3. npm install pdffiller --save

  4. Edit app.component.ts:

    import { Component } from '@angular/core'; import { pdffiller } from 'pdffiller';

@Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'] }) export class AppComponent { title = 'app';

sourcePDF = "./test/test.pdf"; destinationPDF = "./test/testJDoe.pdf";

data = { "last_name" : "John", "first_name" : "Doe", "date" : "Jan 1, 2013", "football" : "Off", "baseball" : "Yes", "basketball" : "Off", "hockey" : "Yes", "nascar" : "Off" };

doFill(event) {

pdffiller.fillForm( this.sourcePDF, this.destinationPDF, this.data, function(err) { if (err) throw err; console.log("In callback (we're done)."); });

}

}

  1. Edit app.component.html:

    Welcome to {{ title }}!

Try test pdf

<button (click)="doFill($event)" Test PDF>

  1. ng serve ng serve NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ Date: 2018-03-21T21:31:35.963Z
    Hash: 18557726d72714bcba44 Time: 6720ms chunk {inline} inline.bundle.js (inline) 3.85 kB [entry] [rendered] chunk {main} main.bundle.js (main) 18.9 kB [initial] [rendered] chunk {polyfills} polyfills.bundle.js (polyfills) 549 kB [initial] [rendered] chunk {styles} styles.bundle.js (styles) 41.5 kB [initial] [rendered] chunk {vendor} vendor.bundle.js (vendor) 9 MB [initial] [rendered]

WARNING in ./node_modules/iconv/build/Release/iconv.node Module parse failed: Unexpected character '�' (1:0) You may need an appropriate loader to handle this file type. (Source code omitted for this binary file)

ERROR in ./node_modules/iconv/lib/iconv.js Module not found: Error: Can't resolve '../build/Debug/iconv.node' in '/Users/nabgilby/Google Drive/Code/Web/testFill/node_modules/iconv/lib' ERROR in ./node_modules/pdffiller/index.js Module not found: Error: Can't resolve 'child_process' in '/Users/nabgilby/Google Drive/Code/Web/testFill/node_modules/pdffiller'

webpack: Failed to compile.

Thank you for your consideration.

gowthamyaal commented 5 years ago

I am facing the same error in Reactjs, can't solve this issue, can you help me with it.?