function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vikash Kumar MandalVikash Kumar Mandal 

getcontentasPDF is not working from site guest user help

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!
Best Answer chosen by Vikash Kumar Mandal
Deepali KulshresthaDeepali Kulshrestha
Hi Vikash,

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 

All Answers

MKRMKR
Hi,

Please ensure that yout site guest user profile has an access to the Visualforce page that you are trying to render to PDF.

Regards,
Miika
Vikash Kumar MandalVikash Kumar Mandal
Hi Miika

I have all the permission to the site guest user profile but it is not working.

Thanks!
Deepali KulshresthaDeepali Kulshrestha
Hi Vikash,

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 
This was selected as the best answer
Vikash Kumar MandalVikash Kumar Mandal
Thanks! 
Deepali Kulshrestha now it is working.
Rahul Kainth 3Rahul Kainth 3

@Deepali/@Vikash

Hi,
I am facing kind of same issue. The only change is that I am using community instead of site. I am also getting blank pdf pages for guest user. I have tried what deepali has mentioned above. I just want to understand whether I am doing it right or not. Suppose my community url is 'https:abc.com'. On runtime, I am attaching some parameters in the URL. Suppose now url is 'https://abc.com/?id=123456'. I tried with both without parameter and with parameter URL in pageReference instance. The pdf is still giving blank pages. Can you please help me?