Announcements
Hi
I try to save/export AX 2009 report to pdf file using ReportRun class. Its working fine but when i try to open this pdf in custom c# application i got error - "Pdf file is damaged or protected with not specified encryption".
If we'r using Adobe to open same report its working fine. Is there any encryption added saved/exported pdf like that?
Code I use to save report :
....
ReportRun rr;
...
_args.name(ReportStr("ReportName"));
_args.record(selectedRecord);
rRun = new ReportRun(_args);
rRun.query().interactive(0);
rRun.report().interactive(0);
rRun.printJobSettings().fileName(@"Directory path + PdfFileName");
rRun.printJobSettings().setTarget(Printmedium::File);
rRun.printJobSettings().format(PrintFormat::PDF);
rRun.run();
Yes, it is.
I just found workaround of this problem, but main problem remains unresolved.
I added rRun.printJobSettings().outputToPrnFile(true); and now report is printed insted of be saved to pdf file. Now everythink works fine.
Stil i've got not idea why saveing report as pdf file is not working properly for me :/
-----
....
ReportRun rr;
...
_args.name(ReportStr("ReportName"));
_args.record(selectedRecord);
rRun = new ReportRun(_args);
rRun.query().interactive(0);
rRun.report().interactive(0);
rRun.printJobSettings().fileName(@"Directory path + PdfFileName");
rRun.printJobSettings().setTarget(Printmedium::File);
rRun.printJobSettings().format(PrintFormat::PDF);
rRun.printJobSettings().outputToPrnFile(true);
rRun.run();
-----
Thanks for respond Martin
Surprisingly, this seems to be the only place on internet where this error message is mentioned. Is it the exact wording?
Hi, thanks for respond. I did it already but it seems to be everything fine in c#. Is there any specific format for this file ( i mean report saved as pdf? ). I'm using most popular library to load and open file in c# app.
Update: When i open it in adobe and save as sample.pdf aplication can open report without any problems
If it works in Adobe Reader, it seems that the problem is in your C# code and not in the file.
Consider getting your code reviewed in a C# forum.
André Arnaud de Cal...
294,241
Super User 2025 Season 1
Martin Dráb
232,982
Most Valuable Professional
nmaenpaa
101,158
Moderator