SaveasPDF from Classic Client

johntaylormfc
Member Posts: 22
I believe that is is not possible to use the Report.SaveAsPDF from the Classic Client.
Could someone please confirm if this is true.
I have created a web service and with this code and when ran from a website it is fine.
Ideally I would like to run this from my classic client.
If the above is true, would it be possible to call my webservice from the classic client to create the PDF version of the report.
This would allow me to email the PDF from classic client, but it would use the nicer formatting of a RTC report.
Any suggsetions?
Thanks
John
Could someone please confirm if this is true.
I have created a web service and with this code and when ran from a website it is fine.
Ideally I would like to run this from my classic client.
If the above is true, would it be possible to call my webservice from the classic client to create the PDF version of the report.
This would allow me to email the PDF from classic client, but it would use the nicer formatting of a RTC report.
Any suggsetions?
Thanks
John
0
Comments
-
Look into PDF creator on sourceforge.net
You can use the Automation provided by PDF creator to save reports into PDF. I wrote numerous solutions using this software.
I even posted some code here in Tips and Tricks that you can use to generate a pdf file.Microsoft Certified Technology Specialist
Microsoft Certified Business Management Solutions Professional
Microsoft Certified Business Management Solutions Specialist
http://www.navisiontech.com0 -
johntaylormfc wrote:I believe that is is not possible to use the Report.SaveAsPDF from the Classic Client.
Could someone please confirm if this is true.
I have created a web service and with this code and when ran from a website it is fine.
Ideally I would like to run this from my classic client.
If the above is true, would it be possible to call my webservice from the classic client to create the PDF version of the report.
This would allow me to email the PDF from classic client, but it would use the nicer formatting of a RTC report.
Any suggsetions?
Thanks
John
It's true, you cannot use it in Classic client. But of course, you can call the WebService from within NAV classic client.
See e.g. http://mibuso.com/blogs/ara3n/2009/01/2 ... companies/0 -
Suddenly this web service solution is the answer to every question?0
-
kine wrote:It's true, you cannot use it in Classic client. But of course, you can call the WebService from within NAV classic client.
See e.g. http://mibuso.com/blogs/ara3n/2009/01/2 ... companies/
This is what I am after. People will be emailing orders from a website or from within NAV. This should let them both call the same service, shich runs the same report, formatted in Visual Studio.
Will look better and only one report to manage.
Will try tomorrow and let you know how I get on.
Thanks
john0 -
ara3n wrote:Suddenly this web service solution is the answer to every question?
Yes, mainly if it is clever, evident and easy solution like this... +good blog article...
evident + easy + good blog = bestseller0 -
ara3n wrote:Suddenly this web service solution is the answer to every question?
yeah but if you don't put this stuff in the downloads section how are we supposed to vote for it. \:D/David Singleton0 -
I have had a look at this code and believe I understand what it is doing.
I have changed it and pointed to my web service, but get an error
“Http Error 401 : Unauthorised”
I have tried running it from the a client on the server, windows authentication, logged in as Administrator. Also have tried changig the web service to run as Administrator, but still getting this error.
As you probably can tell I dont know much about permissions etc.
Any suggestions.
Thanks again.
John0 -
Have made a change
added user and password to this line
XmlHttp.open('POST','http://figaro:7047/DynamicsNAV/WS/CRONUS/Codeunit/WebFunctions',0, 'user',
'Password');
Now get Http Error 500: Internal Server Error
It is now saying That my function name TK_CreatePOPDF is invalid. Still digging
Possibly Progress0 -
Well I can now admit to being an idiot.
I had a codeunit 50000 already, so imported the fob which had overwritten my CU, renumbered it and then reimported mine.
I have ony just noticed that the renumber changed my web service to point the new number if the imported CU, not my original one.
Now works a treat,
Thanks
john0 -
In case anyone is Interested the code was as follows
CU 50000 called web services has a function
TK_CreatePOPDF(PONo : Code[20]) : Text[1000]
PH.INIT;
PH.RESET;
PH.SETRANGE("No.", PONo);
filename := 'C:\temp\';
filename += FORMAT(CREATEGUID);
filename := DELCHR(filename, '=', '{-}');
filename += '.pdf';
REPORT.SAVEASPDF(10576, filename, PH);
EXIT(filename);
The Publish this CU as a web Service called "WebFunctions"
The add a function to the Purchase Header
CreatePDF()
IF ISCLEAR(XmlDoc) THEN
CREATE(XmlDoc);
IF ISCLEAR(XmlHttp) THEN
CREATE(XmlHttp);
XmlHttp.open('POST','http://figaro:7047/DynamicsNAV/WS/CRONUS/Codeunit/WebFunctions',0, 'username',
'password');
XmlHttp.setRequestHeader('Content-Type', 'text/xml; charset=utf-8');
XmlHttp.setRequestHeader('SOAPAction','TK_CreatePOPDF');
XmlHttp.setTimeouts(10000,10000,10000,0); //change last parameter to zero to wait till webservice finishes the job
XmlHttp.send('<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' +
'<soap:Body><TK_CreatePOPDF xmlns="urn:microsoft-dynamics-schemas/codeunit/WebFunctions">' +
'<pONo>'+"No."+'</pONo>'+
'</TK_CreatePOPDF></soap:Body></soap:Envelope>');
IF XmlHttp.status <> 200 THEN
MESSAGE('Http Error ' + ' ' + FORMAT(XmlHttp.status) + ': ' + XmlHttp.statusText);
XmlDoc.async := FALSE;
XmlDoc.load(XmlHttp.responseBody);
XmlNode := XmlDoc.selectSingleNode('//Soap:Envelope/Soap:Body/TK_CreatePOPDF_Result/return_value/');
IF NOT ISCLEAR(XmlNode) THEN BEGIN
MESSAGE('PDF created on server in '+XmlNode.text);
END ELSE BEGIN
XmlDoc.save('C:\temp\response.xml');
HYPERLINK('C:\temp\response.xml');
ERROR(Text50002);
END;
CLEAR(XmlDoc);
CLEAR(XmlHttp)
Now NAV can call "Purchase Header".CreatePDF
The web site where some users enter PO's can call WebFunctions.TK_CreatePOPDF
I now will update this to email the PDF
Thanks for all the help0 -
David Singleton wrote:ara3n wrote:Suddenly this web service solution is the answer to every question?
yeah but if you don't put this stuff in the downloads section how are we supposed to vote for it. \:D/
:-k alIright I'll submit this one.0 -
johntaylormfc wrote:Well I can now admit to being an idiot.
I had a codeunit 50000 already, so imported the fob which had overwritten my CU, renumbered it and then reimported mine.
I have ony just noticed that the renumber changed my web service to point the new number if the imported CU, not my original one.
Now works a treat,
Thanks
john
I believe I attached as a text file so that users can change it to what ever object they want it to.
Thanks for the feedback. I'm sure other people will use this solution.
It sort of promotes people to upgrade to 2009.
You are welcome.0 -
0
-
Hi Rashed,
Thank you very much for the solution.
I have tried to implement the same but receiving an error as follows
"either the caller does not have the required permission for the specified path is read-only".
I am runing on the server with classic client and as an administrator with windows login.
With the same login I am able to acess the same folder and have full control in security.
Please let me know if you or anyone can help me on the same.
Cheers --
Swapnil0 -
Is the service tier and web service running as administrators?0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions