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).
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)
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?
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
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
Comments
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?
AJ
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.
Alex
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 ....
AJ