Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Saving PDF report to file AX 2009

1,938 views
Skip to first unread message

AgNi00

unread,
Dec 3, 2009, 4:46:01 AM12/3/09
to
I want my invoice created to file an not printed to screen.
Is there anything else that I have to do with the printjobsettings to get it
to work? Tried this job where I set the filename, format and printmedium but
it still just prints to screen.

static void job(Args _args)
{
CustInvoiceJour InvJTbl;
SalesId Id;
ReportRun report;
RecordSortedList List = new RecordSortedList(62);
SalesFormLetter_Invoice SalesFormLetter;
;
salesformletter = new SalesFormLetter_Invoice(false);


Id = "100000002";

Select InvJTbl Where InvJTbl.SalesId == Id;
List.ins(InvJTbl);
report = new ReportRun(new Args(ReportStr(SalesInvoice)));
report.args().caller(null);
report.args().object(List);
report.printJobSettings().setTarget(PrintMedium::File);
report.printJobSettings().format(PrintFormat::PDF);
report.printJobSettings().fileName("C:\\Temp\\Test.pdf");
report.run();

}

Klaas Deforche

unread,
Dec 3, 2009, 6:03:03 AM12/3/09
to
Hi there,

Check this out, it will help you:
http://www.axaptapedia.com/Printer_Settings_and_Run_From_Code
Remember to pack/unpack the printersettings at the end.

I would advise trying it with a simple report first (like cust), because the
reason it doesn't work is probably because you printersettings are
overwritten in the report itself.
See fetch() method of the salesInvoice report:
salesFormLetterReport.loadPrintSettings(...).
Here, your settings are overwritten with setup (I don't know where this is
set up...).

Hope this helps,
Best regards,
Klaas.
----------------
http://www.artofcreation.be

Axel Kühn

unread,
Dec 3, 2009, 2:23:01 PM12/3/09
to
Hi,
please take a look at an article i wrote about how to post and print
salesorders with x++.
In the article you can find an example on how you can print a confirmation
to pdf.

http://translate.google.com/translate?client=tmpg&hl=de&u=http%3A%2F%2Fblog.ak-home.net%2FPermaLink%2Cguid%2C5cb22557-acb4-41ec-9546-c65d681e3a3d.aspx&langpair=de|en

Hope this hepls you.
--
Sincerely yours
Axel Kühn (visit my Dynamics AX blog at: http://blog.ak-home.net)

AgNi00

unread,
Dec 4, 2009, 2:39:01 AM12/4/09
to
Thanks for helping me out here. It was correct that my code was overwritten
in the fetchmethod. I moved my printersettings to fetch and now it works just
fine.

Justin Biggs

unread,
Dec 22, 2009, 4:24:06 PM12/22/09
to
You shouldn't need to change anything in the fetch() method in this case.
All you need to do is pass your printJobSettings into the SalesFormLetter
class and pass that class as the caller (instead you're setting the caller to
null). The salesFormLetterReport.loadPrintSettings(...) call will unpack the
printer settings in the salesFormLetter class passed as the caller.
--
Best Regards,
Justin

Eduardo Arias

unread,
Mar 28, 2011, 3:12:00 PM3/28/11
to
Check this post - This is the basis to save a report as PDF

http://axwonders.blogspot.com/2011/02/save-microsoft-dynamics-ax-2009-report.html

This post will give you more specifics about how to create an email class and other things related to saving and sending a report in PDF through Outlook

http://axwonders.blogspot.com/2011/02/save-microsoft-dynamics-ax-2009-report_23.html


>> On Thursday, December 03, 2009 6:03 AM Klaas Deforche wrote:

>> Hi there,
>>
>> Check this out, it will help you:
>> http://www.axaptapedia.com/Printer_Settings_and_Run_From_Code
>> Remember to pack/unpack the printersettings at the end.
>>
>> I would advise trying it with a simple report first (like cust), because the

>> reason it does not work is probably because you printersettings are


>> overwritten in the report itself.
>> See fetch() method of the salesInvoice report:
>> salesFormLetterReport.loadPrintSettings(...).

>> Here, your settings are overwritten with setup (I do not know where this is


>> set up...).
>>
>> Hope this helps,
>> Best regards,
>> Klaas.
>> ----------------
>> http://www.artofcreation.be
>>
>>
>> "AgNi00" wrote:


>>> On Thursday, December 03, 2009 2:23 PM Axel Kühn wrote:

>>> Hi,
>>> please take a look at an article i wrote about how to post and print
>>> salesorders with x++.
>>> In the article you can find an example on how you can print a confirmation
>>> to pdf.
>>>
>>> http://translate.google.com/translate?client=tmpg&hl=de&u=http%3A%2F%2Fblog.ak-home.net%2FPermaLink%2Cguid%2C5cb22557-acb4-41ec-9546-c65d681e3a3d.aspx&langpair=de|en
>>>
>>> Hope this hepls you.
>>> --
>>> Sincerely yours

>>> Axel K??hn (visit my Dynamics AX blog at: http://blog.ak-home.net)
>>>
>>>
>>> "AgNi00" wrote:


>>>> On Friday, December 04, 2009 2:39 AM AgNi00 wrote:

>>>> Thanks for helping me out here. It was correct that my code was overwritten
>>>> in the fetchmethod. I moved my printersettings to fetch and now it works just
>>>> fine.
>>>>
>>>>
>>>> "Klaas Deforche" wrote:


>>>>> On Tuesday, December 22, 2009 4:24 PM Justin Biggs wrote:

>>>>> You should not need to change anything in the fetch() method in this case.


>>>>> All you need to do is pass your printJobSettings into the SalesFormLetter

>>>>> class and pass that class as the caller (instead you are setting the caller to

0 new messages