Opening a specific record template as pdf on button click via openUrl

Opening a specific record template as pdf on button click via openUrl

If I use a function to email a record template as a pdf I can choose a specific record template ("testRNtemplate") from several I have created using the syntax:

sendmail
[
from :zoho.adminuserid
to :zoho.adminuserid
subject :"pdf is attached"
message :"pdf is attached"
Attachments :template:testRNtemplate as pdf
]

Now if I want to download the pdf on button click this sort of function seems to work but I cannot figure out how to specify a particular template. It seems to always download the default template. 

void defaultFunction(Sample_Requests dummy)
{
}

Is there a way to specify which template gets downloaded?