foliojs / pdfkit

A JavaScript PDF generation library for Node and the browser
http://pdfkit.org/
MIT License
9.69k stars 1.14k forks source link

Uncaught TypeError: doc.initForm is not a function. Can't get the forms working. #1325

Open smammadov1994 opened 2 years ago

smammadov1994 commented 2 years ago

Hello community, I am having an issue where I cannot run doc.initForm(). I get the output "Uncaught TypeError: doc.initForm is not a function." I want to essentially add an input field into the document that I render in the browser for the client and have them fill it out and submit it back to the server. Is there a way to do this?

import pdfkit from "pdfkit"; var blobStream = require("blob-stream");

import fs from "fs"; import Helvetica from "!!raw-loader!pdfkit/js/data/Helvetica.afm"; fs.writeFileSync("data/Helvetica.afm", Helvetica);

const doc = new pdfkit(); doc.font("Helvetica"); doc.initForm();

arendraifsnider commented 2 years ago

I am having the same issue, specifically with using pdfkit.standalone.js.