Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: How to connect printer and pass data using Visual FoxPro scripting Language?

  1. #1
    Junior Member
    Join Date
    May 2024
    Posts
    18

    How to connect printer and pass data using Visual FoxPro scripting Language?

    How do you connect the printer and pass data using Visual FoxPro scripting Language?

    Please suggest steps and sample code.

  2. #2
    Lianja MVP
    Join Date
    Feb 2012
    Location
    Berea, KY, USA
    Posts
    2,187
    Hi T,

    Go to this page: https://www.lianja.com/doc/index.php...ds#Text_Output

    and go to the Reports and Printing section

    Basically, you can take what you want to print, stick it in a text file, and print the file.

    There are options to achieve the same result, of course.

    Hank

  3. #3
    Junior Member
    Join Date
    May 2024
    Posts
    18
    Thanks for the replay.

    It does not work printFile().

    I have already tried the below code but it does not work. Please help.

    local filename = "C:\\lianja\\installers\\dd2.PNG"
    local printerName = "EPSON TM-m30 Receipt"
    local numberOfCopies = 1
    local orientation = "Landscape"
    Lianja.printFile(filename, printerName, numberOfCopies, orientation);
    Last edited by MoonT; 2024-05-27 at 07:02.

  4. #4
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,199
    Blog Entries
    22
    See the doc
    https://www.lianja.com/doc/index.php...hods#printFile


    • Args

    printer as Character, filename as Character

    Try printing a small text file NOT an image.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  5. #5
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,199
    Blog Entries
    22
    There are many alternative ways of printing in LianjaScript/VFP.

    The traditional way in VFP is:

    Code:
    //
    // output text to a file then print it
    //
    set printer to barry.txt
    set print on
    set console off
    ? "hello world"
    set print off
    set printer to
    set console on
    Lianja.printFile("printername", "barry.txt")
    //
    // open the printer port directly
    //
    set printer to com2:
    set print on
    set console off
    ? "hello world"
    set print off
    set printer to
    set console on
    This is just for printing plain text.

    If you want to print a formatted receipt with logo and different fonts in a printer independent manner then generate HTML and use Lianja.printHtml().
    Last edited by barrymavin; 2024-05-27 at 21:22.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  6. #6
    Junior Member
    Join Date
    May 2024
    Posts
    18
    Thanks for reply

    where is this file "barry.txt"

    Need to set any specific path?

    Please guide.

  7. #7
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,199
    Blog Entries
    22
    It is created in the current directory you are working in.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  8. #8
    Junior Member
    Join Date
    May 2024
    Posts
    18
    Thanks for replay


    I try with the below code but not working.

    set printer to "C:\\lianja\\installers\\d1.txt"
    set print on
    set console off
    ? "hello world"
    set print off
    set printer to
    set console on
    Lianja.printFile("EPSON TM-m30 Receipt", "C:\\lianja\\installers\\d1.txt")

    Please suggest if anything missing.

    My printer port is "ESDPRT001"
    Last edited by MoonT; 2024-05-28 at 02:10.

  9. #9
    Lianja Development Team barrymavin's Avatar
    Join Date
    Feb 2012
    Location
    UK, USA, Thailand
    Posts
    7,199
    Blog Entries
    22
    Please stop cross posting in different places.

    Look at

    https://learn.microsoft.com/en-us/wi...commands/print

    and verify from the command line.
    Principal developer of Lianja, Recital and other products

    Follow me on:

    Twitter: http://twitter.com/lianjaInc
    Facebook: http://www.facebook.com/LianjaInc
    LinkedIn: http://www.linkedin.com/in/barrymavin

  10. #10
    Junior Member
    Join Date
    May 2024
    Posts
    18
    Thanks for replay

    Please find attached file.
    Name:  Screenshot 2024-05-28 125122.jpg
Views: 24
Size:  21.5 KB

Tags for this Thread

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us