To run and save the axapta report in PDF format on your hard drive just override the init() method of your report with the following code.
public void init()
{
super();
element.printJobSettings.setTarget(PrintMedium::File); // print format is on file
element.printJobSettings.preferredTarget(PrintMedium::File);
element.printJobSettings.format(PrintFormat::PDF);
element.printJobSettings.preferredFileFormat(PrintFormat::PDF); //file extension is pdf
element.printJobSettings.fileName("c:\\temp\\test-invoice.pdf"); // file location and name
element.printJobSettings().warnIfFileExists(false); // dont show the option to overwrite report file
element.printJobSettings().allPages(false); // dont print all pages of report
element.printJobSettings().from(2); // print from page 2
element.printJobSettings().to(5); //print to page 5
element.query().interactive(false); // disable all dialogue
element.report().interactive(false);
}Regards,
No comments:
Post a Comment