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
Y.OY.O 

Visualforce リンク先 ファイル表示

お世話になっております。

Visualforceのファイル表示に関して質問です。

Visualforce上の
リンク(apex:commandLink)もしくは
ボタン(apex:commandButton)にて、
あらかじめ作成しているPDFファイルを表示させたいと思っております。
このPDFファイルは、
静的リソースに置いて、表示できないかと考えております。
上記は実現可能でしょうか?
もしくは他の方法で実現するしかないのでしょうか?

以上、よろしくお願いいたします。
Best Answer chosen by Y.O
ANUTEJANUTEJ (Salesforce Developers) 
Hi YO,

If I get the question right you want to open a pdf on click of a button if that is the case can you try checking the below line of code to see if it works:

>> <apex:commandButton value="Convert to PDF"  onClick="window.open('/apex/orderReportPDF?id={!Opportunity.Id}');" />

If this was helpful can you please choose this answer as the best answer so that it can be used by others in the future.

Regards,
Anutej

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi YO,

If I get the question right you want to open a pdf on click of a button if that is the case can you try checking the below line of code to see if it works:

>> <apex:commandButton value="Convert to PDF"  onClick="window.open('/apex/orderReportPDF?id={!Opportunity.Id}');" />

If this was helpful can you please choose this answer as the best answer so that it can be used by others in the future.

Regards,
Anutej
This was selected as the best answer
Y.OY.O
sorry, How can I display the PDF placed in a static resource?
ANUTEJANUTEJ (Salesforce Developers) 
I have not tried it yet but I think inside the window.open(here you would be giving the url to the static resource) I hope this helps.
Y.OY.O
Thank you very much. I'll give it a try.