You need to sign in to do that
Don't have an account?
Vikash Kumar Mandal
getcontentasPDF is not working from site guest user
Hi All,
I have made a visualforce page and I want to render it as pdf and store in one field. I have created the apex class and using future callout for the generation of PDF. When I tried from the backend then the PDF is generating correctly but at the same time when I am trying from the site guest user then the content is not rendering on PDF. It is generating only the blank PDF.
Please help me with this. How to resolve this issue.
Thanks!
I have made a visualforce page and I want to render it as pdf and store in one field. I have created the apex class and using future callout for the generation of PDF. When I tried from the backend then the PDF is generating correctly but at the same time when I am trying from the site guest user then the content is not rendering on PDF. It is generating only the blank PDF.
Please help me with this. How to resolve this issue.
Thanks!
There might be chances that you are missing the required permission of sObject for this guest user.
So first check your guest user have all required permission.
Then you need to make sure The Guest User is able to directly access the visualforce page which you render as PDF. So in order to provide access to it you have to construct a URL for it. If the Guest User finds the path through its URL it will support the call getContentAsPDF(); and values will be present in the PDF.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi
I have given all the permission to the guest user. and I am using
PageReference pdf = Page.TestLetter;
pdf.getParameters().put('oppId',oppId);
but it is not working.
Thanks!
I think you have to change your URL please put site URL in the page reference URL with the page name I also face this problem once.
This is because the URL of the Page for the Site is changed and it can not access the page so it returns a blank pdf.
Please try this, if any other query feels free to ask.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha