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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Can't print barcodes on pdf from the 2nd file

(0) ShareShare
ReportReport
Posted on by 1,087

Hi everyone,

i need to print a large amount of pdf files (100 or more) containing barcodes. I've got a class which calls the report many times inside a while loop, something like this:

PrintJobSettings              printJobSettings = new PrintJobSettings();
Args                                    args;

ReportRun                               reportRun;
Report                                  report;

while select custTable where ...

{

            args = new Args(ReportStr(MyReport));
            args.caller(this);

            //report parameters
            args.parm(custTable.AccountNum);

            reportRun = new ReportRun(args);

            report = reportRun.report();
            report.interactive(false);

            printJobSettings = reportRun.printJobSettings();
            printJobSettings.setTarget(PrintMedium::File);
            printJobSettings.format(PrintFormat::PDF_EMBED_FONTS);
            printJobSettings.fileName(path   custTable.AccountNum   '.pdf');

            printJobSettings.lockDestinationProperties(true);
             reportRun.run();

}

The issue is everything works fine for the first pdf file it prints, but from the 2nd file it starts to mess up the barcodes: it shows symbols and letters instead of the barcode image:

errore.jpg

The right version (as in the first file it prints) should be:

7737.ok.jpg

To make it work I have wrote a job to print a single file and I launch it manually several times. This is the only way I found to make it work properly, but it's not a good solution.

Anyone experienced the same issue and have found some workaround to manage it?

Thank you in advance

regards

I have the same question (0)
  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi,

    Can you not do the printJobSettings Inititialization in the while loop as well? Please try this code -

    PrintJobSettings                        printJobSettings;
    Args                                    args;
    
    ReportRun                               reportRun;
    Report                                  report;
    
    while select custTable where ...
    
    {
    
                args = new Args(ReportStr(MyReport));
                args.caller(this);
    
                //report parameters
                args.parm(custTable.AccountNum);
    
                reportRun = new ReportRun(args);
    
                report = reportRun.report();
                report.interactive(false);
    
                printJobSettings = new PrintJobSettings();
    
                printJobSettings = reportRun.printJobSettings();
                printJobSettings.setTarget(PrintMedium::File);
                printJobSettings.format(PrintFormat::PDF_EMBED_FONTS);
                printJobSettings.fileName(path   custTable.AccountNum   '.pdf');
    
                printJobSettings.lockDestinationProperties(true);
                 reportRun.run();
    
    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 522 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans