I tried to print a report (showrequestform=false, showprinterdialog=false) but this is not possible from WS. I get an error saing "Client callback (such as showing Pages) is not supported when executing custom Web services". Why is this not possible? I don't have a page or any user interaction! The reason for this is we want to replace a NAS Solution with a Webservice.
0
Answers
-I generate the PDF with SAVEASPDF
-I use R2's DotNet Interop to use a DLL from Forensictools.net that can print PDF without the need of Acrobat Reader (But Printer must support PostScript)
The DLL is free! http://forensictools.net/
That way you can print your document to a printer of your choice in no time.
I use .NET interop to start a process with the parameter -t <pdf file> <printer> to print the generated pdf file. Printing time is very fast (like 2 sec. reaction time from webservice call to printing start).
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
in my C# program it gives me this error:
{"This message is for C/AL programmers: The call to member Run failed: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)."}
i cant solve this ](*,) .
anyone got some ideas?
is there a more simple solution to print through webservice yet? i am using nav 2009 R2.
Thanx!
Report.run
instead you need to change it to Report.saveasPDF.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
The saveaspdf part works fine.
its the printing part that gives the problem.
The shell foxit does not work.
i used the code from this post:
viewtopic.php?f=23&t=27688&start=0&hilit=foxit
Thanks, Johan
My guess the user running the webservice doesn't have permission.
Independent Consultant/Developer
blog: https://dynamicsuser.net/nav/b/ara3n
PrintPDF Function:
StartProcess Function:
Name DataType Subtype Length
Process DotNet 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.Process
ProcessInfo DotNet 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.ProcessStartInfo
there did came a paper out of the printer \:D/ .
But still got an error:
This message is for C/AL programmers: The call to member Run failed: The system cannot find the file specified. (Exception from HRESULT: 0x80070002).
the program prints the document and can continue.
any idea?
Thanks a lot!!!
i am very happy with it.
Thanks a lot =D>
This is the code.
the function startrprocess is exactly like above.
realy needed? I thought SAVEASPDF exits as soon as the file is generated so that such a check would be useless. have you tested this?
when generating files with for example bullzip pdf printer i use it to.
so when the next comando is givven i am sure the file exists.
it works anyway.
headerNo is the parameter to get the right invoice.
(the invoice number i send from C#).
'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.System.Diagnostics.Process
ProcesInfo is datatype Dotnet with subtype:
'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b
The StartProces function is this:
Is there a dll I must add?
i think you need to.
Tell me, when u add a global variable , u have "dotnet " in datatype list?
Please can u export ur codeunit that include the startprocess function.
if you want to do this in SP1 you need to use Windows Script Host Shell.
This's what u mean by script shell or u have another solution.
with this you can run the command. Don't forget to create the automation:
Please u know the commande that print directly form foxit, like in adobe one ""C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe /p /h C:\PdfDocuments\bb.pdf""
And thank u one more time
it is '<PathToFoxit.exe> -t <PathToPDFfile> <Printer>'
I do wsh.run or wsh.exec
please can u give me the right code
and sorry :oops: