Print external HTML file from NAV

alexjensen
Member Posts: 41
Hi all
I'm looking for a way to print an external HTML file to a specific printer using NAV code. The print must be done without any user interaction (e.g. by a NAS).
Any ideas?
AJ
I'm looking for a way to print an external HTML file to a specific printer using NAV code. The print must be done without any user interaction (e.g. by a NAS).
Any ideas?
AJ
0
Comments
-
I had created a solution for a situation like this using 'Internet Explorer' Automation (I created it to print UPS shipment labels without GUI interface.) But it would use the default printer.
I do not know of any Automation's currently out there that will do what you wish. You may just need to create a custom .NET solution yourself.
Hope at least I provided some clarity.
(And by no means does NAV give you the freedom to do this straight from C/AL)0 -
Xypher wrote:I had created a solution for a situation like this using 'Internet Explorer' Automation (I created it to print UPS shipment labels without GUI interface.) But it would use the default printer.
I do not know of any Automation's currently out there that will do what you wish. You may just need to create a custom .NET solution yourself.
Hope at least I provided some clarity.
(And by no means does NAV give you the freedom to do this straight from C/AL)
Hi Xypher
Could You share You automation example so I can try that?
AJ0 -
Got this from somewhere on the forum here... prints every file you like i guess.
lv_FileName := 'C:\TREM Kaarten\test.html';
PrintFile(lv_FileName);
SplitDirFile(FullString : Text[250];VAR JustDir : Text[250];VAR JustFileName : Text[250])
ExitLoop := FALSE;
PointBreak := STRLEN(FullString);
WHILE (NOT ExitLoop) OR (PointBreak <= 1) DO
IF COPYSTR(FullString,PointBreak,1) = '\' THEN BEGIN
JustFileName := COPYSTR(FullString,PointBreak + 1);
ExitLoop := TRUE;
END ELSE
PointBreak -= 1;
JustDir := COPYSTR(FullString,1,PointBreak);
PrintFile(PrintThisFile : Text[250])
IF ISCLEAR(objShell) THEN
CREATE(objShell);
SplitDirFile(PrintThisFile,Dir,FileName);
objFolder := objShell.NameSpace(Dir);
objFolderItems := objFolder.Items;
objFolderItem := objFolderItems.Item(FileName);
objFolderItem.InvokeVerb('PRINT');
objVerbs := objFolderItem.Verbs;
Used variables:
Name DataType Subtype Length
objShell Automation 'Microsoft Shell Controls And Automation'.Shell
objFolder Automation 'Microsoft Shell Controls And Automation'.Folder
objFolderItems Automation 'Microsoft Shell Controls And Automation'.FolderItems
objFolderItem Automation 'Microsoft Shell Controls And Automation'.FolderItem
objVerbs Automation 'Microsoft Shell Controls And Automation'.FolderItemVerbs
Dir Text 250
FileName Text 2500 -
tompynation wrote:Got this from somewhere on the forum here... prints every file you like i guess.
lv_FileName := 'C:\TREM Kaarten\test.html';
PrintFile(lv_FileName);
SplitDirFile(FullString : Text[250];VAR JustDir : Text[250];VAR JustFileName : Text[250])
ExitLoop := FALSE;
PointBreak := STRLEN(FullString);
WHILE (NOT ExitLoop) OR (PointBreak <= 1) DO
IF COPYSTR(FullString,PointBreak,1) = '\' THEN BEGIN
JustFileName := COPYSTR(FullString,PointBreak + 1);
ExitLoop := TRUE;
END ELSE
PointBreak -= 1;
JustDir := COPYSTR(FullString,1,PointBreak);
PrintFile(PrintThisFile : Text[250])
IF ISCLEAR(objShell) THEN
CREATE(objShell);
SplitDirFile(PrintThisFile,Dir,FileName);
objFolder := objShell.NameSpace(Dir);
objFolderItems := objFolder.Items;
objFolderItem := objFolderItems.Item(FileName);
objFolderItem.InvokeVerb('PRINT');
objVerbs := objFolderItem.Verbs;
Used variables:
Name DataType Subtype Length
objShell Automation 'Microsoft Shell Controls And Automation'.Shell
objFolder Automation 'Microsoft Shell Controls And Automation'.Folder
objFolderItems Automation 'Microsoft Shell Controls And Automation'.FolderItems
objFolderItem Automation 'Microsoft Shell Controls And Automation'.FolderItem
objVerbs Automation 'Microsoft Shell Controls And Automation'.FolderItemVerbs
Dir Text 250
FileName Text 250
Thanks. I'll have a look at it.
Alex0 -
Works very fine, but is there a way not to open the application (eg. Word, Notepad) and choose a printer?0
-
mgm wrote:Works very fine, but is there a way not to open the application (eg. Word, Notepad) and choose a printer?
I ended up using a small (and not very expensive) utility like this:
http://bersoft.com/htmlprint/index.htm
If there's anything like it for free I don't know ....
AJ0
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