Skip to content
This repository has been archived by the owner on Sep 25, 2022. It is now read-only.

Cant Add Image to pdf in the first go #9

Open
rishavtandon93 opened this issue Mar 13, 2018 · 0 comments
Open

Cant Add Image to pdf in the first go #9

rishavtandon93 opened this issue Mar 13, 2018 · 0 comments

Comments

@rishavtandon93
Copy link

rishavtandon93 commented Mar 13, 2018

When I add image to the pdf and open it, the image does not appear, however if I reopen the pdf for the second time the image appears.
openpdf ()
{
this.pdfmake.addText('Your Package contents are as follows');
this.pdfmake.addText('Property Details');
this.pdfmake.addText(this.packageData.property.property_type);
this.pdfmake.addText(this.packageData.property.configuration);
this.pdfmake.addText("-----------------------------------------------------------------------------------------------------------------------------");
if(this.assetsByRoom.length){
for(let i=0;i<this.assetsByRoom.length;i++)
{
this.pdfmake.addText(this.assetsByRoom[i].name);
if(this.assetsByRoom[i].assets)
{
for(let j=0;j<this.assetsByRoom[i].assets.length;j++)
{
console.log('Exexuting 1stline',this.assetsByRoom[i].assets[j].asset_name);
this.pdfmake.addText(this.assetsByRoom[i].assets[j].asset_name);
console.log('Exexuting 2ndline',this.assetsByRoom[i].assets[j].asset_price);
this.pdfmake.addText(this.assetsByRoom[i].assets[j].asset_price);
console.log('assetImageUrl3rdline',this.assetsByRoom[i].assets[j].asset_image);
this.pdfmake.addImage(this.assetsByRoom[i].assets[j].asset_image,300,150);
// this.pdfmake.addImage('http://localhost:3000/assets/5a82d4a7b7e7446775be4e23/5a82d4a7b7e7446775be4e23.jpg',300,150);
// this.pdfmake.addImage('http://upload.wikimedia.org/wikipedia/commons/4/4a/Logo_2013_Google.png');
}
}
this.pdfmake.addText('Room Subtotal');
this.pdfmake.addText(this.assetsByRoom[i].subTotal);
this.pdfmake.addText("-----------------------------------------------------------------------------------------------------------------------------");
}
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants