Using PDF-lib and Node.js to populate PDF form

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Nice job! FYI to anyone who is working with PDF-Lib and encounters an encrypted PDF like this, the `PDFDocument.load()` function takes an object parameter that can be passed to it called ignoreEncryption and set the property to true. The error that was thrown in the video at around time index 4:05 shows that you can use PDFDocument.load(…, { ignoreEncryption: true } )
So like so: `const pdfDoc = await PDFDocument.load(await readFile(input), { ignoreEncryption: true })`
no need for the third party website like ilovepdf to unlock. Great overview of filling forms with PDF-Lib! Thanks @kalman
😀

bjbk
Автор

Great thank you. I was reading the documentation on pdf-lib but couldn't figure out how to use the file system instead of URL as in the examples. Gonna follow your instructions. Thanks again

xfilercuba
Автор

Thank you so much! This is exactly what I needed. You did an outstanding job - clear and to the point.

asyan.
Автор

Thank you for the video, have been searching for a while to get this done :)

monnsoftware
Автор

Thank you very much sir ❤
I find a better why to figure out the name of each input field, with the code below you will be able to open your output pdf file and see each text input filled with its name and each checkbox checked :

const form = pdfDoc.getForm()
const fields = form.getFields()
fields.forEach(field => {
const type = field.constructor.name
const name = field.getName()
if(type == 'PDFCheckBox') {
console.log(`${type}: ${name}`)
field.check()
} else {
field.setText(name)
}
})

zeeu
Автор

sir I did try to pass object value in the setText but it return undefined. how do I implement this. someone please help

我展现速度
Автор

You have a unique ability to teach. I've seen many people and work from home tutors on Udemy and other places, but you have a level of patience that is critical for knowledge transfer. Keep it up!

lodashnotebook
Автор

is there a way to make the text boxes clickable in the first place, if they are not on the given pdf?

krishras
Автор

Nice video. What package for convert pdf to image?

willyhorizont
Автор

is it possible to insert the data by taking them from a php form?

skosso
Автор

how would you know the type of the field from getFields method? is there a way?

bencilao
Автор

Great, 🙏 is pdf-lib is open source and free to use in production

amitkumdixit
Автор

can you plz make it with react js and node js dynamically

gmanikamnaidu
Автор

Is it possible to connect this to a HTML front-end?

drphil
Автор

How i can learn it from the beginning!

Efootball.player.unknown
Автор

Exactly what I needed!
Thank U so much! ô/

andersonsilva
Автор

this wont work if ur pdf doesnt have a textfiled of checkboxes

Ad-mvey
Автор

Your enter button must last a year how hard you hit it. Thank you for the tutorial.

simonblurton