julianhille / MuhammaraJS

Muhammara a node module with c/cpp bindings to modify PDF with js for node or electron (based/replacement on/of galkhana/hummusjs)
Other
205 stars 43 forks source link

Best way to add watermark to all the pages of PDF #318

Closed ladvishal1985 closed 10 months ago

ladvishal1985 commented 11 months ago

I have PDF files that are downloaded using a signed URL. I would like to add watermark to all the pages of PDF without requiring to write the pdf file to disk and just allow browser to download the file. I referred this example https://github.com/julianhille/MuhammaraJS/issues/284 Can we pass byteArray/blob instead of passing the path to read the pdf for modification ?

julianhille commented 11 months ago

https://github.com/julianhille/MuhammaraJS/issues/289#issuecomment-1482942617

have a look here this might answer your question if i understand correctly.

In this example the file "originated from a base64 string" instead of a file

let me know if that helps or points you to the solution to your problem, also if i misunderstood.

julianhille commented 11 months ago

im sorry i misunderstood. Here is an example to directly write to a response stream: https://github.com/julianhille/MuhammaraJS/blob/develop/samples/PDFServer.js#L10

julianhille commented 10 months ago

i close this for now as it seems fixed to me with the samples above. feel free to reopen if you tested it and it does not help you.

thanks