You need to sign in to do that
Don't have an account?
Das M
Saved PDF (VF rendered as pdf) has broken image
We are developeing a VF page where we can capture customer signature and attach it to the record.
The code is developed based from following 2 posts.
http://corycowgill.blogspot.in/2013/12/capturing-signatures-with-html5-canvas.html
http://blog.jeffdouglas.com/2010/07/14/attach-a-pdf-to-a-record-in-salesforce/
It's done it 2 steps.
First we capture the signature and save it to aatchment as png file.
Second in the Visulforce page we refer this image to include in the VF. (The singnature doc Id is passed as URL parmenter )
This is how it's referd in the VF page that is redered as PDF
<apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}" />
The fileId is the attachment ID of the signature impage
The problem we have is once this page is attached to the record the image is broken. It's not diplaying image.
If I harcode this tag like below
<apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file==00P55000000HHz1" />
Every thing works fine.
I debugged and verified that the URL parmenter is getting the right value.
I would like your help to fix this issue.
I tried 3 diffrtent ways to display the image here as shown in the VF code. But none of them worked.
Can any body find what Iam doing wrong here.
The code is developed based from following 2 posts.
http://corycowgill.blogspot.in/2013/12/capturing-signatures-with-html5-canvas.html
http://blog.jeffdouglas.com/2010/07/14/attach-a-pdf-to-a-record-in-salesforce/
It's done it 2 steps.
First we capture the signature and save it to aatchment as png file.
Second in the Visulforce page we refer this image to include in the VF. (The singnature doc Id is passed as URL parmenter )
This is how it's referd in the VF page that is redered as PDF
<apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}" />
The fileId is the attachment ID of the signature impage
The problem we have is once this page is attached to the record the image is broken. It's not diplaying image.
If I harcode this tag like below
<apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file==00P55000000HHz1" />
Every thing works fine.
I debugged and verified that the URL parmenter is getting the right value.
I would like your help to fix this issue.
<apex:page standardController="Account" extensions="reconInventoryController" renderAs="pdf" > <apex:form > <!--- <apex:outputPanel styleClass="panelWrapper" layout="block"> <apex:pageBlock title="Inventory Updated" > </apex:pageBlock> </apex:outputPanel> ---> <apex:pageBlock title="{!theAccount.Name} - Inventory Dated ( {!Today()})"> <apex:pageBlockTable value="{!inventories}" var="c"> <apex:column value="{!c.Name}" /> <apex:column value="{!c.Pendant_Serial_Number__c}" /> <apex:column value="{!c.Shelf_Life__c}" /> <apex:column value="{!c.Ship_Date__c}" /> <apex:column value="{!c.Phone_Serial_Number__c}" /> <apex:column value="{!c.Data_Retrieval__c}" /> <apex:column value="{!c.Status__c}" /> <apex:column value="{!c.Comments__c}" /> </apex:pageBlockTable> </apex:pageBlock> {!MySignURL} <!-- <apex:image url="{!MySignURL}" width="256" height="256"/> <apex:image value="/servlet/servlet.FileDownload?file=00P55000000HSTHEA4" /> ---> /servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId} <apex:image url="/servlet/servlet.FileDownload?file={!MySignURL}" /> <apex:image Url="https://c.cs41.content.force.com/servlet/servlet.FileDownload?file={!$CurrentPage.parameters.fileId}" /> <apex:image value="{!URLFOR($Action.Attachment.Download, $CurrentPage.parameters.fileId )}" /> </apex:form> </apex:page>Here is the screenshot of the PDF that got attached through the code.
I tried 3 diffrtent ways to display the image here as shown in the VF code. But none of them worked.
Can any body find what Iam doing wrong here.
Can you try seperating the processes out? Save the attachment, then have that launch a new VF page that fires the email template?
All Answers
If I open this VF Page direcltly in URL lke (https://c.cs41.visual.force.com/apex/InventoryPDF?id=00155000006SlRy&fileId=00P55000000HHz1
It works fine. It renders the signature image as expected.
Otherwise I don't understand your question.
Can you try seperating the processes out? Save the attachment, then have that launch a new VF page that fires the email template?
In place of the static resource , please save the image in the document folder and check the check box for externally use image and after that use that image in the vf page it will see correctly.
Thanks
Gyani.
Gyani- Thanks for your input. I was not using Static Resources. I am using the staradard attachments.