Hello. Whenever I try to add image to my pdf, the scripts generate the following error:
Uncaught TypeError: Cannot read property 'embed' of undefined
However when I add sampleImage.img as a source everything seems to be working fine.
{
image: 'sampleImage.jpg',
width: 100,
height: 100,
}
Is there some special requirements which need to be met?
Thanks
Image needs to be in base64
Well... thank you. It solved my problem.
I should have read it more carefully.
Does it mean, images need to be converted into base 64 before passing?
yup!
On 11 August 2015 at 13:21, arunsahni [email protected] wrote:
Does it mean, images need to be converted into base 64 before passing?
—
Reply to this email directly or view it on GitHub
https://github.com/bpampuch/pdfmake/issues/90#issuecomment-129843419.
@Wabbala im trying to convert into base64, but doesnt works.
is possible get the image without convert?
Look at this pdfmake documentation snippet:
{
// under NodeJS (or in case you use virtual file system provided by pdfmake)
// you can also pass file names here
image: 'myImageDictionary/image1.jpg'
}
What do they mean by "virtual file system provided by pdfmake" ? How do I use it?
@SergioMacGyver That would be data-uri-encoding images with gulp into the vfs_fonts.js file, as specified in step 1 of https://github.com/bpampuch/pdfmake/wiki/Custom-Fonts---client-side.
https://github.com/bpampuch/pdfmake#images
What do they mean by myImageDictionary ?
help plz !
Thanks !
hi @atefBB it means when client side you will load your website then it can be something like 'content/img/image1.jpg'
@sorb999 Thanks.
Most helpful comment
Look at this pdfmake documentation snippet:
What do they mean by "virtual file system provided by pdfmake" ? How do I use it?