open pdf from web service

Belias
Member Posts: 2,998
hi everyone, i'm moving my first steps in creating pages and codeunit web services, and i've done this little function, that creates the pdf of the purchase report.
fntprint(pTBPurchHead : Record "Purchase Header")
thanks in advance
P.S.: the HYPERLINK obviously work when called from an action in the page. it's just the webservice that doesn't work
fntprint(pTBPurchHead : Record "Purchase Header")
TXTFileName := 'C:\pdftest\'; TXTFileName += 'test.pdf'; REPORT.SAVEASPDF(402,TXTFileName,pTBPurchHead); HYPERLINK(TXTFileName);as you can see, it's really raw code, but it works like a charm in my little winform...the problem is that the hyperlink function does not work...why?
thanks in advance
P.S.: the HYPERLINK obviously work when called from an action in the page. it's just the webservice that doesn't work
0
Answers
-
SAVEASPDF - saving on the service tier server
HYPELINK - running on the client...
If you have service tier on different server than client, you cannot do that... ;-)0 -
kine wrote:SAVEASPDF - saving on the service tier server
HYPELINK - running on the client...
If you have service tier on different server than client, you cannot do that... ;-)0 -
Why do you have both listed as TXTFile Name?
TXTFileName := 'C:\pdftest\';
TXTFileName += 'test.pdf';
Shouldn't the first one be TXTFilePath? Or is that where the += comes in?0 -
Savatage wrote:Why do you have both listed as TXTFile Name?
TXTFileName := 'C:\pdftest\';
TXTFileName += 'test.pdf';
Shouldn't the first one be TXTFilePath? Or is that where the += comes in?...well, reviewing the code...it has nothing to do with the original code, i copied just the method of extending the page webservice through codeunit...
as i said, it's just raw code to work a bit with web services...do you like it more if i write this?TXTFileName := 'C:\pdftest\test.pdf'; REPORT.SAVEASPDF(402,TXTFileName,pTBPurchHead); HYPERLINK(TXTFileName);
here's the blog if you want to take a look to a nice trick, but it's Off Topic...
http://blogs.msdn.com/b/freddyk/archive/2009/11/17/extending-page-web-services-and-creating-a-sales-order-again.aspx0 -
well...i solved it with these lines of C# code...
String filename = String.Format("{0:d}",service.Fntprint(mypurchorder.Key)); System.Diagnostics.Process.Start(filename);
fntprint is a nav function that runs the report as pdf and returns a text variable with the name of the created file
"{0:d}" is..........i don't know, i just copied it from somewhere... :whistle: :whistle:
P.S.: don't take this solution as a good example, because i don't know C#...there are probably better ways to solve this, but it works for my testing purposes0
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