[solved] Print Sequence of escape in NAVISION

rossalerossale Member Posts: 26
Hi,
I would like to send a sequence of ascape to a printer by building a report? Is it possible ?

I read about an OCX (See this http://www.mibuso.com/dlinfo.asp?FileID=341) made by Ing. Kamil Sacek. Could every one help me to use it ? I'm really new in development on NAVISION. :(

Thanks a lot !!

Alex

Comments

  • kinekine Member Posts: 12,562
    I can help you, because it is my software... :-)

    If you install the ocx and you will create Automation variable for it ('NaviPrinter Library'.NaviPrinterClass), the variable has one method DirectPrint with two parameters. First is name of printer (look into Pritner table for the names of available printers) and second one is string with the data which will be direclty send to the printer. And that's all... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rossalerossale Member Posts: 26
    Hi Ing. Sacek, Thank's for your answer. I don't find the Printer Table... what is the number? Is possible to configure?

    Thank's

    :D
    Alex
  • kinekine Member Posts: 12,562
    The printer table is virtual table no. 2000000039. For more info search the forum for Virtual and Tables.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kinekine Member Posts: 12,562
    And it is not possible to configure, it is just "send this to this printer". Original purpose was to send data to LCD screen connected on the parallel port.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rossalerossale Member Posts: 26
    Hi Ing. Sacek, I've finally found the printer's table (thanks). Now, when I execute the CU, it show this error: "This Automation variable has not been instatiated... etc.".

    This is the sequence that i've done:
    1) I've registered your dll with REGSVR32
    2) I've created a new CU and instantiate a variable (named NaviPrint) of type "Automation" referencing 'NaviPrinter Library'.NaviPrinterClass.
    3) I've created two other variable:
    pathtxtFile - Text - 30
    PrinterName - Text - 50
    4) Then in OnRun() event:
    pathtxtFile := 'c:\text.txt';
    PrinterName := '\\Printer\Generic / Text Only';

    NaviPrint.DirectPrint(PrinterName, pathtxtFile);

    What's wrong?

    Thank's ](*,)

    Alex
  • ta5ta5 Member Posts: 1,164
    Use create for the automation variable.

    Regards
    Thomas
  • rossalerossale Member Posts: 26
    Thank you Thomas.

    Now I try.

    Alex
  • rossalerossale Member Posts: 26
    Hi,
    it work!! Actually only on local printer... :?

    Have this DLL a limit of size of th printing variable? I have to print a heuge sequence of ascape (around 830 char....) containing some special characters (like { or ; or , ) .

    How can I do?

    Thanks to all. :D

    Alex
  • kinekine Member Posts: 12,562
    The string can be max. 1024 char long (because NAV is not able to use longer strings). In C# it is String...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • kinekine Member Posts: 12,562
    rossale wrote:
    Hi,
    it work!! Actually only on local printer... :?

    It is working over Terminal Services too, you just needs to send the data to correct network printer.... :-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rossalerossale Member Posts: 26
    Hi,
    I've a problem: ](*,) when I execute the CU, now it show this error:
    The Text '.............' is too long. Text can have a maximum length of 30 character

    What does it means? The string wasn't max. 1024 char long ?

    I'm sure that I do some errors but I don't know how to do. :cry:

    Thanks

    Alex

    I enclose the source.

    In OnRun() Event:
    txtFile.WRITEMODE := TRUE;
    txtFile.TEXTMODE := TRUE;
    txtFile.QUERYREPLACE := TRUE;
    
    txtFile.CREATE('c:\textNav.txt');
    
    txtFile.CREATEOUTSTREAM(strOutStream);
    strOutStream.WRITETEXT('{D0370,0400,0350|}{T20C52|}{AX;+000,+000,+00|}{AY;+00,0|}{C|}{PC000;0377,0300,10,15,T,22,B|}');
    strOutStream.WRITETEXT('{PC001;0361,0262,05,05,B,22,B|}{PC002;0380,0144,05,05,A,22,B|}');
    strOutStream.WRITETEXT('{PC003;0380,0121,05,05,A,22,B|}{PC004;0380,0095,05,05,A,22,B|}');
    strOutStream.WRITETEXT('{PC005;0380,0070,05,05,A,22,B|}{PC006;0380,0045,05,05,A,22,B|}');
    strOutStream.WRITETEXT('{PC007;0380,0020,05,05,A,22,B|}{XB00;0311,0251,5,3,03,2,0060,+0000000000,020,1,00|}');
    strOutStream.WRITETEXT('{RC000;X.XXXX              |}{RC001;XXXXXXXXXXXXX    XXX|}');
    strOutStream.WRITETEXT('{RC002;XXXX                                                                                     |}');
    strOutStream.WRITETEXT('{RC003;XXXX                                                                                     |}');
    strOutStream.WRITETEXT('{RC004;XXX.XXX                                                                                  |}');
    strOutStream.WRITETEXT('{RC005; |}{RC006; |}{RC007; |}{RB00;4002154654441|}');
    strOutStream.WRITETEXT('{LC;0000,0325,0700,0325,1,4|}{RM;-00-00|}{XS;I,0001,0002C5200|}');
    
    txtFile.CLOSE;
    
    CREATE(NaviPrint);
    
    pathtxtFile := 'c:\textNav.txt';
    txtFile.OPEN(pathtxtFile);
    
    PrinterName := 'StampaSuFile';
    NaviPrint.DirectPrint(PrinterName, txtFile.READ(pathtxtFile));
    

    And in GLOBALS:
      txtFile File pathtxtFile Text 30 strOutStream OutStream NaviPrint Automation 'NaviPrinter Library'.NaviPrinterClass PrinterName Text 50
    "
  • kinekine Member Posts: 12,562
    txtFile.READ(pathtxtFile) is reading the line into the parameter and not from the file you pass as parameter... :-) read the documentation...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • rossalerossale Member Posts: 26
    =D>

    IT WORKS VERY WELL THIS DLL!! GREAT!!

    Now it work correctly also the correct network printer !!!

    Thanks.


    Alex
  • kinekine Member Posts: 12,562
    You are welcome! (and just one thing: the DLL is just simple example from Microsoft pages compiled into form usable by NAV - see http://support.microsoft.com/kb/154078)

    And please, should you add [solved] prefix into the first post subject? Thanks.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.