web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to print multiple copies of SSRS report in PDF format

(0) ShareShare
ReportReport
Posted on by 325

Hi Everyone, I want to know how to print Custom SSRS report to multiple copies in PDF format. I have tried the below code in Controller class but it is not working

controller.parmArgs(_args);

controller.parmReportName(ssrsReportStr(SONSalesInvoiceSITLSSL, SITLSalesInvoiceReport));

sonSalesInvoiceContract = controller.getDataContractObject('sonSalesInvoiceContract');
printSettings = controller.parmReportContract().parmPrintSettings();
parmContract = controller.parmReportContract().parmRdpContract();
numofPages = sonSalesInvoiceContract.parmNumbofPages();

printSettings.printMediumType(SRSPrintMediumType::File);
printSettings.numberOfCopies(numofPages);
printSettings.fileFormat(SRSReportFileFormat::PDF);
printSettings.fileName("SalesInvoiceReport");
printSettings.overwriteFile(true);
printSettings.printLandscape(false);

controller.startOperation();

*This post is locked for comments

I have the same question (0)
  • Ravikumar Profile Picture
    325 on at

    Hi Crispin,

    Thanks for the quick reply.

    I think you mean to say I need to add the below line right?

    controller.parmReportContract().parmPrintSettings(printSettings);

    I have added but no luck. Whats happening is it is saving a single copy, even through I tried hardcoding.

  • Ravikumar Profile Picture
    325 on at

    Yes I forgot to remove this line.  Now I removed it, but still the same, it is printing single copy.

  • Ravikumar Profile Picture
    325 on at

    I moved the code here I am getting the error saying Args object not initialized

  • Ravikumar Profile Picture
    325 on at

    Hi Crispin, No error now, but I think it is overriding on the same file even though I set

    printSettings.overwriteFile(false); and even tried removing this line.

    I hope I need to loop below line with diff filename based on the no of copies i need, printSettings.fileName("SalesInvoiceReport");

    am I right? if Yes dont know how to do it

  • Ravikumar Profile Picture
    325 on at

    after changing the code as below, it is printing multiple times on screen, but Batch window is popping up each time. I need to do below changes

    1. Disable batch window which is popping up each time

    2. Pass file name as variable - printSettings.parmFileName(@'D:\\Temp\SalesInvoiceReport.pdf');

    Can you help me how to achieve it.

    printSettings = this.parmReportContract().parmPrintSettings();

    contract = this.parmReportContract().parmRdpContract();

    numofCopies = contract.parmNumbofPages();

       while (copy < numofCopies)

       {

           copy++;

           printSettings.printMediumType(SRSPrintMediumType::Screen);

           //printSettings.fileFormat(SRSReportFileFormat::PDF);

           printSettings.overwriteFile(true);

           printSettings.printLandscape(false);

           printSettings.numberOfCopies(1);

           printSettings.parmFileName(@'D:\\Temp\SalesInvoiceReport.pdf');

           this.parmReportContract().parmPrintSettings(printSettings);

           this.startOperation();

       }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans