[SalesForce] How to pass document id dynamically in help url

I tried to pass document id dynamically and i am going to render that pdf document when we click on help link. but not getting how to achieve this..

here in below pageblock component i want to pass the id dynamically in help url,

   <apex:pageBlock id="menoPageBlockBtn" helpTitle="Help" helpUrl="/servlet/servlet.FileDownload?file=015L00000008icY" rendered="{!isComplete}" tabStyle="Account">

in class it seems i need to add this,

    public string documentid {get;set;}

    Document d = [Select d.Id From Document d where d.DeveloperName = 'check_form'];
    documentid = '/servlet/servlet.FileDownload?file='+d.Id;

Please tell me how do i achieve this?

Best Answer

In Controller use this code:

public Document doc{get;set;}

Inside constructor:

doc =new Document();
doc =[Select d.Id From Document d where d.DeveloperName = 'check_form' limit 1];

In Visualforce page use this code

<apex:pageBlock id="menoPageBlockBtn" helpTitle="Help" helpUrl="/servlet/servlet.FileDownload?file={!doc.id}" rendered="{!isComplete}" tabStyle="Account">