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
MycodexMycodex 

render as PDF downloads as unknown file type

Was trying to play around with the new PDF functionality of Visualforce. I found a post (http://community.salesforce.com/sforce/board/message?board.id=Visualforce&message.id=1782) that shows how to dynamically display it based on the url. When I ran the following code, I receive a File Download dialog box saying

Name: vforcetest.url=1
Type: Unknown File Type

When I save the file and then rename it from vforcetest.url=1 to vforcetest.pdf, the page opens up in Adobe Reader displaying the pdf correctly.  I've tested this both in a developer sandbox and in production along with different profiles. Has anyone run into something like this? I changed a page to renderas pdf last week and it worked fine.

Here is the code I used:


Code:
<apex:page renderAs="{!if($CurrentPage.parameters.p == null, null, 'pdf')}"> 
    <apex:pageBlock title="Some Page Block">
        <apex:pageBlockSection title="Section 1"> Text </apex:pageBlockSection>
        <apex:pageBlockSection title="Section 2"> Text </apex:pageBlockSection>
    </apex:pageBlock>
    <apex:outputLink rendered="{!$CurrentPage.parameters.p == null}" value="/apex/vforcetest—p=true" target="_blank">PDF</apex:outputLink>
</apex:page>





ミン グェン バンミン グェン バン
did you solve this problem  ?
I got the same error.

Thanks !
Minh