If you want to publish a PDF-report on an Intranet/Intranet site you can use the following instructions. The PDF is created on the fly and sends to the webpage via Web Services and parses to a PDF in memory before it reach the user, there are no need for temporary save the PDF on the web server before showing it. The same procedure can be used to publishing other binary files for example images, excel, word and simple text-files.
1. NAV. Create a function with 2 parameters.
Get temp path, create some random file name. Filter out the Record set and use the record set as a parameter to REPORT.SAVEASPDF function. I use the TempBlob table to temporary save the PDF and then pass it to a BigText via DotNet library Array, Convertm MemoryStream. The Parameter PDF is marked as var and accepts new data and returns it to the system who consume the web service. Save the code unit and publish it as a Web Service, open table Web Service and add a line.
2. C# ASP.net
As an example here is a simple way to test this. Software Visual Studio Web Developer Express 2010
1. Create project
2. Add web service reference
5. Create the new web page.
And if you lucky its works..
I found this pretty fast, it will not take much longer to show is at web then in RTC Client. You may want to edit your Service settings to make the session to live longer to avoid the “cold start feeling” each time the web service is called.
NAV fob: pdf_to_web.zip
Web Project: webproject.ZIP
Tags: NAV 2009