• ミン グェン バン
  • NEWBIE
  • 0 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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>





  • September 08, 2008
  • Like
  • 1
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>





  • September 08, 2008
  • Like
  • 1