Open rubenjimenez opened 7 years ago
Code seems fun. How about you include the image? Maybe hummus isnt happy with it. Also try creating a log, maybe itll have useful insights
If you don't see any weird in the code, I'm starting to think that the image could be the problem. I'll try with another different one. I'll post the results.
I put some console.logs but they didn't return anything interesting...
a log:
hummus.createWriterToModify(__dirname + '/pdfs/aed_invoice_mockup.pdf', { modifiedFilePath: certificatePath + certificateName, log: _dirname + '/logs/aed_invoice_mockup.txt' });
Ah, I didn't know that option exists.
This is the log I'm getting:
[ 17/08/2017 13:01:42 ] ObjectsContext::WriteXrefTable, Unexpected Failure. Object of ID = 22 was not registered as written. probably means it was not written
[ 17/08/2017 13:01:42 ] PDFWriter::EndPDF, Could not end PDF
But It remains a mystery for me. Is it clearer for you?
Well, object 22 that wasnt written is prbbly the one containing the image data. It wasnt wrutten prbbly because it didnt like the image.
That's correct. Finally, it is the image. I don't know why, but it is only that precisely image.
I've tried with another different images and it works.
Thanks Gal.
wanna send me the image? i can look and see what's the problem with it
This one for example:
easy one. aint no jpg. its a png. pngs not supported by hummus.
True.
I have used Sharp to convert the image to JPEG and that's the way I've been able to add the image to the PDF.
Thanks Gal for your insights.
Anyway, is there any plan to support PNG in Hummus?
not right now. png would be great. it supports transparency and its super common, but i'm busy on other projects. what i am looking at adding next to hummus is support for webassembly
pngs are now supported
Great news. Thanks for your dedication!
I know this project is no longer actively maintained, but I would greatly appreciate it if anyone could point me to a solution or even just a reason as to why this still occurs, although only on certain images.
Hi,
I've been looking for this problem in the general list of issues and I haven't found how to fix it.
I've got a PDF I'm using it to modify. I add text and everything works like a charm, but when I've tried to add an image I'm getting this error:
This is my code:
Although the code may seem a little confusing, it is quite simple. I write some text several times and finally I add the image. I write the page and end the context afterwards. Here it is where I'm getting the error.
As I said, If I remove the drawImage line all the code works as expected.
Any clue about what I'm doing wrong?
Thanks!
* I've checked the image is accesible and it exists.