Announcements
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:
The right version (as in the first file it prints) should be:
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
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(); }
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156