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
AtnMAtnM 

Sites PDF Generation

Hi!

 

I have controller that returns a visualforce page as a pdf. It works in my development organization but when I installed it into my production organization it stopped working. It seems like it has something to do with the security settings since I get the site is down for maintenance message. Is there somewhere I can enable pdf generation for the public user? I couldn't see it in the site settings anywhere.

 

Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

We might not be able to fix this in the short term. The issue related to going through caching (DE editions are not tied to caching so it works in these editions, as well as sandbox orgs)
 
Your only option is to use the secure url (which bypasses the caching) http://abc.secure.force.com for the pages that generates pdf for now.
 
 
*** 5/22/09 Update ***
We have the fix now. I'll update this posting when the fix is deployed to the production 
 
*** 5/27/09 Update ***
The fix is part of Summer 09 release. If you have sandbox org with sites on CS0/CS2/CS3 then you can test the fix which is depoyed to these sandbox instances today. 

Message Edited by Bulent on 05-27-2009 05:12 PM

All Answers

Scott JorgensenScott Jorgensen
PDF generation is always enabled.  There is no setting to turn it on or off.  Are you able to use your debug log monitoring to get some insight into how far your page got in it's processing before you end up on the "under maintenance" page?
AtnMAtnM

I tried to capture the guest user logs but it didn't show any errors, just success

 

The weird thing is that it depends on the context. If I try to generate the pdf from the website url it fails but if i'm logged into the salesforce account and enter /apex/pagename?pdf=1 it works fine. The other thing to note is that the contents of the page are identical in html and pdf mode and it displays fine in html mode.

 

I'm thinking there might be something funky going on since the page is part of a package. 

 

I have noticed that if you have a reference to an sobjec that's part of a package in a page that's part of the same package that isn't in an apex tag it fails for example:

 

<apex:outputText value="{!CustomObject__c.CustomField__c}" />

works well

 

{!CustomObject__c.CustomField__c}

 

doesn't work unless you explicitely append the package namespace like this

 

{!stgcms__CustomObject__c.stgcms__CustomField__c}

 

 

 

BulentBulent
We are looking in to this. Seems like DE orgs work fine but active orgs are resulting with an error.
BulentBulent

We might not be able to fix this in the short term. The issue related to going through caching (DE editions are not tied to caching so it works in these editions, as well as sandbox orgs)
 
Your only option is to use the secure url (which bypasses the caching) http://abc.secure.force.com for the pages that generates pdf for now.
 
 
*** 5/22/09 Update ***
We have the fix now. I'll update this posting when the fix is deployed to the production 
 
*** 5/27/09 Update ***
The fix is part of Summer 09 release. If you have sandbox org with sites on CS0/CS2/CS3 then you can test the fix which is depoyed to these sandbox instances today. 

Message Edited by Bulent on 05-27-2009 05:12 PM
This was selected as the best answer
AtnMAtnM

Awesome, thanks!

 

:) 

Scott.MScott.M

For some reason the PDF generation is still not working for our production organization. It works perfectly in the Sandbox environment but not in the Production environment

 

Scott 

BulentBulent

Scott,

 

Seems like if the page has static resources then we have the issue. If you have a different case please let me know.

 

We have the fix ready and we will deploy it to the production soon. I'll update the post once it's deployed. 

Scott.MScott.M

I tried to use the secure url as a temporary fix however I'm experiencing some weird behavior. If I click the pdf link from the public page then the page returns a file not found error. If I then copy the url into a new window or just put my cursor into the address bar and click enter it returns the PDF as expected. For example if you go to the following url:

 

https://stantive.secure.force.com/apex/stgcms__StantiveArticle?name=Cloud-Computing-Explained&pdf=1 

 

you get the expected pdf 

 

if you click a link on the site with the exact same url it returns file not found. 

 

Very odd :) 

 

Scott

BulentBulent
the fix is deployed to production last night, you don't have to use the https url workaround anymore. 
Scott.MScott.M

Thanks,

 

It does work now.

 

Cheers,

Scott