Closed GautierT closed 7 years ago
Hi ! First : Awesome package... ! Thanks a lot. I have this script :
const pdfWriter = hummus.createWriterToModify('./test.pdf', { modifiedFilePath: './' + 'test_edit' + '.pdf' }) const pdfReader = hummus.createReader('./test.pdf') const number_pages = pdfReader.getPagesCount() let pageModifier for (let i = 0; i < +number_pages; i++) { debug('Page : ', i) pageModifier = new hummus.PDFPageModifier(pdfWriter, i, true) // Set true : https://github.com/galkahana/HummusJS/issues/81#issuecomment-231165846 if (i === 0) { //pageModifier.startContext().getContext().drawRectangle(295, 607, 300, 128, {type: 'fill', color: '0xFF45DE'}) pageModifier.startContext().getContext().drawRectangle(295, 607, 300, 128, {type: 'stroke', color: '0xFF45DE', width : 5}) const arialFont = pdfWriter.getFontForFile('./Lato-Regular.ttf') const textOptions = {font: arialFont, size: 14, colorspace: 'gray', color: 0x00} pageModifier.startContext().getContext().writeText('Zone', 310, 707, textOptions) } pageModifier.startContext().getContext().drawRectangle(0, 303, 31, 23, {type: 'fill', color: '0xFF0000'}) pageModifier.endContext().writePage() } pdfWriter.end()
(Did i write to many things ? Am i using it right ? The color parameter don't seems to work. I always get black... ! Thanks for your support.
Its a number, not a string. Compare with the tests. And one context should be enough.
grrr ... sorry ! Thanks a lot !
:)
Hi ! First : Awesome package... ! Thanks a lot. I have this script :
(Did i write to many things ? Am i using it right ? The color parameter don't seems to work. I always get black... ! Thanks for your support.