Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Print from visualisation

JAPIB
2014-10-02
2020-07-14
  • JAPIB

    JAPIB - 2014-10-02

    Hello
    I use a version of CoDeSys that runs on a PC.
    In a display page I input and display numeric values ​​(INT)
    I store in a text file numeric these values ​​using the library SYSFILE. it works very well

    How is it possible, from the view page, with a button for example, start printing the text file to a printer ?

    Thank you in advance for your great ideas

     
  • PhGo - 2015-06-12

    Hello!
    Have you solved this problem ?
    I am face on the same !

    Best Regard.
    Phillippe

     
  • TimvH

    TimvH - 2015-06-13

    I'm not sure if it is the best solution, but an option could be to start a system command on the PC.
    Add the SysProcess library to your project.

    sCommandString: STRING := 'print ....';
    myResult: UDINT;
    uiResult: UDINT;
    
    (* Execute command *)
    uiResult := _(pszComand:= sCommandString, pResult:= ADR(myResult));
    

    You just need to find out what the command line option is to print your files to your specific printer.

     
  • PhGo - 2015-06-16

    Thank you!
    I haved try this code with sucess

    Β  Β  CreateCmdResult:= SysProcess.SysProcessCreate(pszApplication:='C:\windows\notepad.exe', 
    Β  Β Β  Β pszCommandLine:='/PT "C:\File2print\file.txt" "PDFCreator" ' ,ulHide:=0 ,ADR(pResult1));
    

    For notepad
    There is a limited set of command line options:

    /A <filename> open file as ansi
    /W <filename> open file as unicode
    /P <filename> print filename
    /PT <filename> <printername> <driverdll> <port> print filename to designated printer
    
     
  • falcon - 2020-07-14

    if i want to store some runtime data in a text file. what is the way to do that ? please guide , i am stuck :-(

     
  • falcon - 2020-07-14

    if i want to store some runtime data in a text file. what is the way to do that ? please guide , i am stuck :-(

     

Log in to post a comment.