AX 2012: Print SSRS Report in PDF to Disk

Purpose:

The purpose of this document is to illustrate how we can print an SSRS report in PDF format to disk or file-system in X++.

Business requirement:

Ability to print an SSRS report in PDF format to disk or file-system automatically.

Assumptions:

SSRS report is successfully deployed to the report server.

Development:

Please find below the job to write SSRS report in PDF to disk or file-system.

// Developed on 01 Feb 2016 by Muhammad Anas Khan
// Blog: dynamicsaxinsight.wordpress.com
// LinkedIn: pk.linkedin.com/in/muhammadanaskhan
// Description: Write SSRS report in PDF to disk
static void makPrintSSRSReportToDisk(Args _args)
{
    //Instantiate custom controller
    SRSPrintDestinationSettings printSettings;
    SrsReportRunController 	controller = new PurchPurchaseOrderController();
        
    controller.parmReportName(ssrsReportStr(PurchPurchaseOrder, Report));

    //Get print settings from contract
    printSettings = controller.parmReportContract().parmPrintSettings();

    // set print medium
    printSettings.printMediumType(SRSPrintMediumType::File);
    printSettings.fileFormat(SRSReportFileFormat::PDF);
    printSettings.overwriteFile(true);
    printSettings.fileName(@"C:\Temp\PurchPurchaseOrder.pdf");

    // suppress the parameter dialog
    controller.parmShowDialog(false);
    controller.startOperation();
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s