You need to sign in to do that
Don't have an account?
Broken Image show in PDF when I sent out this PDF by email
Hi Everyone,
Since I am new to Salesforce.
I have request from my customer regarding sending out an email with PDF.
My problem is that in the PDF I need to show image in there too but the problem is that the image shown in the PDF is
broken. Image is save in the document and Externally Available is true.
I have tried several scenario since I cannot use the actual URL of the image directly.
1) I have tried putting image URL in Rich Text Field (in img tag) . In salesforce image is showing correctly but when I send out an
email this image is showing as broken.
2) I have try putting image URL in URL field and then using that field in the PDF but image is still broken,
Can anyone guide me on how should I do it ?
Thank a lot.
Hi BHinners ,
This is my lines of code : https://c.cs6.content.force.com/servlet/servlet.ImageServer?id='+DocumentID+'&oid='+OrganisationID
If I used the direct URL of am image it works but if I use in this way the image is showing as broken image
When I hardcode URL it works :
https://c.cs6.content.force.com/servlet/servlet.ImageServer?id=015N0000000CkAI&oid=00DN0000000AB3c
When I use id from Apex controller the image is broken :
https://c.cs6.content.force.com/servlet/servlet.ImageServer?id='{!DocumentID}+'&oid='+{!OrganisationID}
I cannot use the static resource as the image is send in the base64 form.
Right now I am creating barcode each time the base64 image is being send from another system.
This is the code that I used to create document.
Blob Pic;
Pic = EncodingUtil.base64Decode(Base64code);
Document UploadDoc = new Document();
UploadDoc.Body = Pic;
UploadDoc.Name = 'Barcode : '+BillPayment.Billing_Barcode_CS_ID__c;
UploadDoc.ContentType = 'image/jpeg';
UploadDoc.IsPublic = true;
UploadDoc.FolderId = '00lN0000000MuAL';
UploadDoc.Type = 'jpeg';
insert(UploadDoc);
In another way, if the image is save in Rich text field can I access that image ?