Ocx directprint

abab Member Posts: 37
edited 2009-04-16 in Navision Attain
I've installed the dll without any problem, made a report in navision that creates an ascii-file
with the necessary escape-codes and now I want to print my label with the next command


pathtxtFile := 'c:\textNav.txt';
PrinterName := '\\FIPRI\PR36--BP1344';
NaviPrinter.DirectPrint(PrinterName, pathtxtFile);


But this doesn't work, what am i doing wrong ?

Thx,

alexander

Comments

  • kinekine Member Posts: 12,562
    Is the name of the printer in the "printer" table when you are calling this code? If no, the name is wrong. You need to use the name which is in the virtual table "Printer".
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • abab Member Posts: 37
    I've checked and it is the right printername from the virtual printertable!
  • kinekine Member Posts: 12,562
    Ah, I see the problem - the procedure is not reading the text file and printing it. It is printing directly the string you are passing as parameter. You need to read the file in the code and print the lines through the function...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • abab Member Posts: 37
    This is my code and it still doesn't work

    PrinterName := '\\FIPRI\PR36--BP1344';
    CREATE(NaviPrinter);

    pathtxtFile := 'c:\textNav.txt';
    txtfile.open(pathtxtfile);
    txtfile.textmode;
    repeat
    txtfile.read(v_lijn);
    NaviPrinter.DirectPrint(PrinterName,v_lijn);
    until txtfile.pos >= txtfile.len;
    txtfile.close;


    What is wrong ?

    Thx
  • kinekine Member Posts: 12,562
    Try to set the printer to print into file and check if there is something in the file after that...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.