Send a SaveAsPdf report to a printer
gorvega79
Member Posts: 73
hi all
I am working with nav 2009 R2 in classic client. we have a web application connected to navision by WebService, my customer wants to print a report from the pda and send it to a navision configured printer. The report has a layout and i can create the pdf by report function SAVEASPDF but i don´t know how to send this file to a printer.
i have searched in mibuso but almost everything talking about pdf creator (but i have pdf file).
This is the link that convinces me the most, but doesn´t work for me
http://dynamicslancer.blogspot.com.es/2016/09/how-to-print-pdf-file-directly-to.html
there is another way to do this.
thanks. regards
I am working with nav 2009 R2 in classic client. we have a web application connected to navision by WebService, my customer wants to print a report from the pda and send it to a navision configured printer. The report has a layout and i can create the pdf by report function SAVEASPDF but i don´t know how to send this file to a printer.
i have searched in mibuso but almost everything talking about pdf creator (but i have pdf file).
This is the link that convinces me the most, but doesn´t work for me
http://dynamicslancer.blogspot.com.es/2016/09/how-to-print-pdf-file-directly-to.html
there is another way to do this.
thanks. regards
0
Best Answer
-
Hello,
If the file is a PDF you need to have installed Adobe Acrobat Reader, Foxit Reader or other application that deal with PDF files.
You can try to print a Word file (.docx or .doc) in case you have Office installed.
Regards1
Answers
-
With this code you can print any kinfd of file if you have the application to print it.
If your language is not English you must change the verb name from PRINT to yur local language,OBJECT Codeunit 50099 Print File { OBJECT-PROPERTIES { Date=07/11/17; Time=17:44:20; Modified=Yes; Version List=Print; } PROPERTIES { OnRun=BEGIN END; } CODE { PROCEDURE PrintFile@1000000000(Fichero@1000000011 : Text[1024]); VAR _FileName@1000000000 : Text[250]; Dir@1000000001 : Text[250]; ObjShell@1000000002 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{13709620-C279-11CE-A49E-444553540000}:'Microsoft Shell Controls And Automation'.Shell"; ObjFolder@1000000003 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{BBCBDE60-C3FF-11CE-8350-444553540000}:'Microsoft Shell Controls And Automation'.Folder"; ObjFolderItems@1000000004 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{744129E0-CBE5-11CE-8350-444553540000}:'Microsoft Shell Controls And Automation'.FolderItems"; ObjFolderItem@1000000005 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{FAC32C80-CBE4-11CE-8350-444553540000}:'Microsoft Shell Controls And Automation'.FolderItem"; ObjVerbs@1000000006 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{1F8352C0-50B0-11CF-960C-0080C7F4EE85}:'Microsoft Shell Controls And Automation'.FolderItemVerbs"; ObjVerb@1000000008 : Automation "{50A7E9B0-70EF-11D1-B75A-00A0C90564FE} 1.0:{08EC3E00-50B0-11CF-960C-0080C7F4EE85}:'Microsoft Shell Controls And Automation'.FolderItemVerb"; i@1000000007 : Integer; Nombre@1000000009 : Text[1024]; total@1000000010 : Integer; BEGIN IF NOT EXISTS(Fichero) THEN EXIT; CREATE(ObjShell, TRUE); SplitName(Fichero, Dir, _FileName); ObjFolder := ObjShell.NameSpace(Dir); ObjFolderItems := ObjFolder.Items; ObjFolderItem := ObjFolderItems.Item(_FileName); ObjVerbs := ObjFolderItem.Verbs; i := -1; total := ObjVerbs.Count; REPEAT i += 1; IF i < total THEN BEGIN ObjVerb := ObjVerbs.Item(i); Nombre := ObjVerb.Name; END; UNTIL (STRPOS(UPPERCASE(ObjVerb.Name), 'PRINT') > 0) OR (i > total); IF i <= total THEN BEGIN ObjVerb.DoIt; END ELSE ERROR('The file %1, can not be printed'); END; PROCEDURE SplitName@1000000001(Fichero@1000000000 : Text[1024];VAR Path@1000000001 : Text[1024];VAR Nombre@1000000002 : Text[1024]); VAR Donde@1000000003 : Integer; Pos@1000000004 : Integer; Fichero1@1000000005 : Text[1024]; BEGIN Fichero1 := Fichero; Pos := STRPOS(Fichero1, '\'); Donde := Pos; WHILE Pos <> 0 DO BEGIN Fichero1 := COPYSTR(Fichero1, Pos+1); Pos := STRPOS(Fichero1, '\'); Donde := Donde + Pos; END; Path := COPYSTR(Fichero, 1, Donde); Nombre := COPYSTR(Fichero, Donde+1); END; BEGIN END. } }
1 -
thanks so much for the code. i will try to do this and let you know if it works...thanks again. regards.0
-
[Topic moved from 'NAV Three Tier' forum to 'NAV/Navision Classic Client' forum]
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
hi kriki
The problem i have is how to print a pdf but i have to do this by WS as i have wrote in my topic.
i don´t know why you have moved the topic. maybe a solution works for classic client but maybe doesn´t work for web services. because of this i put the topic in 'NAV Three Tier' forum.
regards.0 -
hi ftornero
i have tried your code but NAV send me this error
"the call to member Star failed: No application is asssociated with the specified file for this operation"
i can´t asociate a file when whe have to print. maybe in the Arguments i have to put the printer name.
thanks.Regards
0 -
Hello,
If the file is a PDF you need to have installed Adobe Acrobat Reader, Foxit Reader or other application that deal with PDF files.
You can try to print a Word file (.docx or .doc) in case you have Office installed.
Regards1 -
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