galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

Add metadata in pdf file using hummus.js #371

Open tajinder-debut opened 5 years ago

tajinder-debut commented 5 years ago

Thanks for writing this awesome library.

I am trying to add metadata in pdf file as key-value pair. Like we can add additional metadata from Acrobat manually. How can we add it through hummus.js??

I have referred https://github.com/galkahana/HummusJS/issues/237 but could not figure out anything. Initially we tried to add out metadata key using .writeKey method but code gave certain error whereas if we trying to write value in already existing key then it creates a file but does not add that value in existing metadata key.

So I tried to add metadata key and valuw and then value to already existing key but did not have any luck in. Any guidelines will be helpful.

Appreciate in advance.

chunyenHuang commented 5 years ago

https://github.com/chunyenHuang/hummusRecipe/blob/master/lib/info.js#L21 https://github.com/galkahana/HummusJS/blob/b699d6a01ba027428120cbe5b1c16813bed0521d/tests/SettingInfoValuesTest.js

JulianNicolas commented 4 years ago

Hi, thank you very very much about writing this awesome lib, is helping me a lot!

I have the same problem that tajinder-debut but I couldn't solve it with those links you @chunyenHuang gave us. I am working on nodejs and I tried with "custom" function but it doesn't add any information.

AddCustomInfo(req, res) { const output = __dirname + "/output/newModificated.pdf"; const pdfDoc = new HummusRecipe(directory, output); pdfDoc.custom("angle","100"); pdfDoc.custom("sense","f"); res.json({ok: true}); } Altought is creating the pdf "newModificated.pdf", this looks the same to the original, without modifications. I want to add some metadata information in order to read it later. am I going by the right way?

Thank you very much in advance!

PD: I tried with Hummus but I couldn't solve it, that why in this example I am using HummusRecipe.