Closed Bastian1975 closed 6 years ago
i'm gonna need some more details of what you are trying to do. how are you trying to embed? maybe the PDF file as sample? script sample would be nice. then I can figure out what's wrong.
Sent you the PDF via mail, this is my sample-code:
var express = require('express'); var app = express(); var hummus = require('hummus'); var pdfWriter = hummus.createWriter("/tmp/targetPDF.pdf"); var pdfpage = pdfWriter.createPage(0,0,892,1417); var cxt = pdfWriter.startPageContentContext(pdfpage); cxt.drawImage(448,643,"/tmp/test.pdf"); pdfWriter.writePage(pdfpage); pdfWriter.end();
seems like this works:
function createFormAndPlace() {
var pdfWriter = hummus.createWriter('./helloFormAndPlace.pdf',{log:'./helloDrawImage.log'})
var pdfpage = pdfWriter.createPage(0,0,892,1417);
var cxt = pdfWriter.startPageContentContext(pdfpage);
var formIDs = pdfWriter.createFormXObjectsFromPDF("./test.pdf",
hummus.ePDFPageBoxMediaBox);
cxt.q()
.cm(1,0,0,1,448,643)
.doXObject(pdfpage.getResourcesDictionary().addFormXObjectMapping(formIDs[0]))
.Q()
pdfWriter.writePage(pdfpage);
pdfWriter.end();
}
supposed to do the same thing. i'll check why... but in the meantime you can use it instead of drawImage
Reporting back. I have found the issue causing drawImage to fail in this case, and fixed it. You should be able to see the correction with 1.0.83 build of hummus.
Thanks, working great now
I get a corrupt PDF with the errors