Print a XML file

Hi All,

I can open a XML formatted invoice with this command at IE:

winapi::shellExecute(FileNameSaveXml);

I want to just print silent and don’t show IE. How can I do this?

What about using WebBrowser.Print() via .NET Interop? Here is an example: How to: Print with a WebBrowser Control.

Can I use this from AX or should I create a .NET DLL?

I think you’ll have to subscribe to DocumentCompleted event and therefore you’ll have to wrap it in class library.

I come to there but I couldn’t fit “webBrowserForPrinting.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(PrintDocument);”

in X++, just run without any print.

System.Windows.Forms.WebBrowser w = new System.Windows.Forms.WebBrowser();
;

u = new System.Uri(filename);
w.set_Url(u);
w.Print();
return;

we created a .net .exe and it worked for us, thank you… :slight_smile: