Hi pioneers,
Can we print AX 2009 SSRS report to PDF through code?
If so, how…
Please suggest…
Hi pioneers,
Can we print AX 2009 SSRS report to PDF through code?
If so, how…
Please suggest…
Hi,
Any one worked on this. Please suggest…
pl check if this link would help you
http://aslam111.blogspot.in/2013/12/save-ssrs-report-to-pdf-that-uses.html
Regards,
Anitha
Hi Anitha,
Please provide the valid answers, i clearly specified AX 2009.
Hi Chaitanya,
do you want to save standard report (SalesInvoice etc) to be saved as PDF?
If so then you need to comment the printjobsetting code in report level and try below code,then only it will allow you to save as PDF file.
Please find the below code for saving the report as PDF file.
static void saveAsPDF()
{
CustInvoiceJour custInvoiceJour;
Args args = new Args();
CustInvoiceJour custInvJour;
InvoiceId _Invoiceid;
SalesId _salesId;
Email mailid,mailid1;
PrintJobSettings printJobSettings = new PrintJobSettings();
SysINetMail m = new SysINetMail();
str fileName,filename1;
SysMailer _sendMail;
InteropPermission perm1;
ReportRun report;
RecordSortedList List = new RecordSortedList(62);
Args argsInv= new Args();
Args argsPOS= new Args();
Reportrun reportInv;
Reportrun reportPOS;
;
try
{
custInvoiceJour = CustInvoiceJour::findRecId(5637151333);
_Invoiceid = custInvoiceJour.InvoiceId;
_salesId = custInvoiceJour.SalesId;
select custInvJour where custInvJour.InvoiceId == custInvoiceJour.InvoiceId;
//for creating first pdf file for salesinvoice Report
mailid = CustTable::find(custInvoiceJour.OrderAccount).Email;
argsPOS.record(custInvJour);
argsPOS.name(reportstr(SalesInvoicePDF));
reportPOS = Classfactory.reportRunClass(argsPOS);
reportPOS.setTarget(PrintMedium::File);
reportPOS.printJobSettings().format(PrintFormat::PDF);
reportPOS.printJobSettings().fileName(“D:\AIF\test.pdf”);
reportPOS.init();
reportPOS.run();
}
catch(Exception::Internal)
{
throw Exception::Internal;
}
}
Thanks & Regards,
Britto John Baskar.A
Hi John,
I clearly specified that i want to save a SSRS report into PDF in AX 2009. Please provide valid answers. SalesInvoice report is not a ssrs one.
SSRS supports PDF, so it surely is possible. Although I’m not familiar with SSRS in AX2009, I believe you can do it by passing appropriate parameters as described here. The parameter for PDF is rs:Format=PDF. You’ll find more about parameters in URL Access (SSRS).
Hi Martin,
Thanks for ur help,
I am looking whether we can print ssrs 2009 report directly instead printing to screen through code.
Your question was about PDF, so did my answer.
Can you be more explicit about what you did and what is the problem you have?
Hi Martin,
My requirement is to print the ssrs report directly through printer in AX 2009… instead showing the report on the screen.
I went many blogs which were saying that we can achieve this but we need to save the report to PDF and thereafter print the report from the path.(This was the only solution that i have now).
So we came to know how to save a report as PDF. (still struggling to provide the default path).
My next goal is to provide the default path to save the report through args, thereafter print it from the path…
static void SaveSSRS_PDF(Args _args)
{
Args args = new args();
menufunction m;
;
args.parm("&rs:Format=" + “PDF” + “&PABudgetVsActual_BudgetYear=” + int2str(2014) + “&PABudgetVsActual_BudgetModel=” + “Budget” + “&PABudgetVsActual_GLCode=” + “16500”);
m = new menufunction(menuitemoutputstr(PABudgetVsActual), menuitemtype::Output);
m.run(args);
}
This works absolutely fine… and asks for a path to save in the system. My question is whether we can save the report
directly to the path(Specified in the args) and is there any way to specify the path through args.
It will be very helpful if you can suggest me whether there is any other way to work on this requirement…
I’m a little bit confused. Do you want “to print the ssrs report directly through printer” or to "save the report
directly to the path"? (Both quoted from your last reply.) Or do you need both?
I need to do the both…
You’ll find example of saving to a file directly in the documentation of Render() method. It’s in .NET - I don’t know whether AX 2009 supports it directly or you’ll have to do it through .NET Interop.
Thanks for ur help martin,
AX won’t support it directly. Looking for an alternate solution…
Hi Chaitanya,
Have to got resolution to your problem? I have a similar requirement where I need to send SSRS sales invoice report as an email attachment. I am also thinking to saving the SSRS as a PDF file somewhere in temporary folder and add that an email attachment.However do know how to provide a default path so it directly save there. I am rely appreciate any help.
Please email directly Kamlesh1977@gmail.com
Thanks !
Kamlesh
Generate SSRS report PDF file automatically in AX 2009
Hi Kamlesh,
I’m adding the link you have found, for anyone referring for a solution.