AX 2009, how to send report to EP?

hello,

I have a method that generates report. How to send the report to ep, that the user could download it as a pdf file?

public static void rep2PDF()
{
EPSendDocument sendDocument;
CustInvoiceJour custInvoiceJour;
Filename filename;
;
select firstonly custInvoiceJour;
filename = WinAPI::getTempPath() +‘MyInvoice.pdf’;
sendDocument = new EPSendDocument(custInvoiceJour);
sendDocument.parmOriginal(true);
sendDocument.parmFileName(filename);
// Make document will run the report and send it to a PDF file with the path specified in filename
sendDocument.makeDocument();
}