Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Print from X++ with printer settings (preferably SRSPrintDestinationSettings)

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi

How can i print a random file (like pdf) from disk/network to any printer. Preferably using SRSPrintDestinationSettings so i can use the printer dialog (SrsReportRunUtil::showSettingsDialog(printJobSettings)) and let the user pick a printer, trays and all other settings.

So not just the printername, but also all the other options should be respected (amount of copies, tray, ...)

*This post is locked for comments

  • Suggested answer
    Mrdude Profile Picture
    Mrdude 285 on at
    RE: Print from X++ with printer settings (preferably SRSPrintDestinationSettings)

    you need use dot net framework

    in below you can found that in c#

    stackoverflow.com/.../send-pdf-file-to-a-printer-print-pdf

    by some change on that you can use that in x++

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Print from X++ with printer settings (preferably SRSPrintDestinationSettings)

    I was hoping to avoid having to write X++/.NET code to parse the SRSPrintSettings object :)

    But it seems like my only option..

  • Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Print from X++ with printer settings (preferably SRSPrintDestinationSettings)

    I've updated the previous post with some more information I could find, I hope it gives some more options.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Print from X++ with printer settings (preferably SRSPrintDestinationSettings)

    At the moment i'm using a .NET class (from the Ex Arte package) to do the printing.

    It accepts a file location and an SRSPrintDestinationSettings object.

    I've done some reversing with ILSpy and noticed they translate the SRS object to a System.Drawing.Printing.PrinterSettings object and from there on print using regular .NET classes. GDPicuture.net classes

    However, it crashes when i use a printer that is not known by the AOS (even though it's ran from client).

    I have a feeling the calls on the DLLs are being called on server? Could this be right?

    My other feeling is that it only supports "spooler" printers instead of "queue" printers. But that's out of my comfortzone :)

  • Suggested answer
    Vilmos Kintera Profile Picture
    Vilmos Kintera 46,149 on at
    RE: Print from X++ with printer settings (preferably SRSPrintDestinationSettings)

    The AX reports do come from SSRS itself, and the printing module is using SSRS too.

    So if you want to print something that is already in PDF, you will not be able to utilize the facility you mention above. A PDF document could be opened though in an HTML control if you install a compatible PDF viewer software with a browser plugin, from where the software could handle printing.

    Alternatively you could write some code and attempt the printing from using .Net namespaces.

    http://www.artofcreation.be/2014/01/27/how-to-print-any-file-in-ax/

    I also found some relevant X++ code too:

    https://community.dynamics.com/ax/b/axaptavsme/archive/2013/08/30/print-pdf-files-from-ax-x-code

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans